-
Notifications
You must be signed in to change notification settings - Fork 0
dpdk example risc v #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: traffic_filtering
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| FROM ubuntu:24.04 | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive \ | ||
| TZ=Europe/Moscow \ | ||
| LANG=en_US.UTF-8 \ | ||
| LC_ALL=en_US.UTF-8 | ||
|
|
||
| RUN apt update && \ | ||
| apt install -y \ | ||
| build-essential \ | ||
| chrpath \ | ||
| cpio \ | ||
| debianutils \ | ||
| diffstat \ | ||
| file \ | ||
| gawk \ | ||
| gcc \ | ||
| git \ | ||
| iputils-ping \ | ||
| libacl1 \ | ||
| liblz4-tool \ | ||
| locales \ | ||
| python3 \ | ||
| python3-git \ | ||
| python3-jinja2 \ | ||
| python3-pexpect \ | ||
| python3-pip \ | ||
| python3-subunit \ | ||
| socat \ | ||
| texinfo \ | ||
| unzip \ | ||
| wget \ | ||
| xz-utils \ | ||
| zstd \ | ||
| sudo | ||
|
|
||
| RUN locale-gen en_US.UTF-8 | ||
|
|
||
| RUN useradd -m -s /bin/bash builder | ||
| RUN echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers | ||
| RUN usermod -aG sudo builder | ||
|
|
||
| WORKDIR /home/builder | ||
|
|
||
| COPY scripts/build/build.sh /home/builder/scripts/build.sh | ||
| COPY scripts/build/run.sh /home/builder/scripts/run.sh | ||
| COPY meta-cluster /home/builder/meta-cluster | ||
| RUN chmod +x /home/builder/scripts/build.sh | ||
| RUN chmod +x /home/builder/scripts/run.sh | ||
|
|
||
| USER builder | ||
|
|
||
| CMD [ "/bin/bash" ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| Инструкция по запуску приложения DPDK на riscv | ||
|
|
||
| ```sh | ||
| make build | ||
| make yocto | ||
| make run | ||
| ``` | ||
|
|
||
| После выполнения комманд, вводим логин `root` и запускаем программу: | ||
|
|
||
| ```sh | ||
| dpdk-helloworld --no-huge | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 MOEVM LETI | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| IMAGE_NAME = yocto-riscv-build | ||
| VOLUME_NAME = qemu | ||
| .DEFAULT_GOAL = help | ||
|
|
||
| build: | ||
| docker buildx build -t $(IMAGE_NAME) . | ||
|
|
||
| yocto: | ||
| docker run --rm -it \ | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавил ограничения по использованию ресурсов компьютера, потому что у меня пару раз намертво зависал компьютер, при попытке сборки. |
||
| --memory=12g \ | ||
| --cpus=8 \ | ||
| -v $(PWD)/$(VOLUME_NAME)/:/home/builder/$(VOLUME_NAME)/:Z \ | ||
| $(IMAGE_NAME) /home/builder/scripts/build.sh | ||
|
|
||
| run: | ||
| docker run --rm -it -v $(PWD)/$(VOLUME_NAME)/:/home/builder/$(VOLUME_NAME)/:Z $(IMAGE_NAME) /home/builder/scripts/run.sh | ||
|
|
||
| test: | ||
| docker run --rm -it -v $(PWD)/$(VOLUME_NAME)/:/home/builder/$(VOLUME_NAME)/:Z $(IMAGE_NAME) /bin/bash | ||
|
|
||
| clean: | ||
| docker rmi $(IMAGE_NAME) | ||
| rm -rf $(VOLUME_NAME) | ||
|
|
||
| help: | ||
| @echo "Makefile for building Yocto Project" | ||
| @echo "" | ||
| @echo "build - build a container image" | ||
| @echo "yocto - build a RISC-V image using Yocto Project" | ||
| @echo "run - run QEMU" | ||
| @echo "clean - delete Docker image and build directory, please, run with \"sudo\"" | ||
| @echo "help - print help information" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # vm_build_risc_v |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| This README file contains information on the contents of the meta-cluster layer. | ||
|
|
||
| Please see the corresponding sections below for details. | ||
|
|
||
| Dependencies | ||
| ============ | ||
|
|
||
| URI: <first dependency> | ||
| branch: <branch name> | ||
|
|
||
| URI: <second dependency> | ||
| branch: <branch name> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # We have a conf and classes directory, add to BBPATH | ||
| BBPATH .= ":${LAYERDIR}" | ||
|
|
||
| # We have recipes-* directories, add to BBFILES | ||
| BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ | ||
| ${LAYERDIR}/recipes-*/*/*.bbappend" | ||
|
|
||
| BBFILE_COLLECTIONS += "meta-cluster" | ||
| BBFILE_PATTERN_meta-cluster = "^${LAYERDIR}/" | ||
| BBFILE_PRIORITY_meta-cluster = "6" | ||
|
|
||
| LAYERDEPENDS_meta-cluster = "core" | ||
| LAYERSERIES_COMPAT_meta-cluster = "kirkstone walnascar whinlatter scarthgap" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| SUMMARY = "Controller" | ||
| DESCRIPTION = "Controller program for cluster" | ||
| LICENSE = "MIT" | ||
| LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
|
|
||
| SRC_URI = "git://github.com/moevm/grpc_server;branch=main;protocol=https;destsuffix=git" | ||
| SRCREV = "${AUTOREV}" | ||
|
|
||
| DEPENDS = "go-native protobuf-native protoc-gen-go-native protoc-gen-go-grpc-native" | ||
|
|
||
| S = "${WORKDIR}/git" | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Во всех рецептах (*.bb) добавил S (Source) директорию, без этого не собиралось |
||
|
|
||
| GOARCH = "${@ "amd64" if d.getVar('TARGET_ARCH') == "x86_64" else "riscv64"}" | ||
|
|
||
| do_configure[noexec] = "1" | ||
| do_compile[network] = "1" | ||
|
|
||
| do_compile() { | ||
| cd ${S}/controller | ||
|
|
||
| protoc \ | ||
| --go_out=. \ | ||
| --go_opt=paths=source_relative \ | ||
| --go-grpc_out=. \ | ||
| --go-grpc_opt=paths=source_relative \ | ||
| pkg/proto/communication/communication.proto | ||
|
|
||
| cd cmd/manager | ||
| GOOS=${TARGET_GOOS} GOARCH=${GOARCH} go build -trimpath -o manager test.go | ||
| } | ||
|
|
||
| do_install() { | ||
| install -d ${D}${bindir} | ||
| install -m 0755 ${S}/controller/cmd/manager/manager ${D}${bindir}/manager | ||
| } | ||
|
|
||
| INSANE_SKIP:${PN} += "ldflags" | ||
|
|
||
| FILES:${PN} = "${bindir}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| SUMMARY = "Cluster Controller" | ||
| DESCRIPTION = "A stub package for the cluster controller node" | ||
| LICENSE = "MIT" | ||
| LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
|
|
||
| SRC_URI = "file://controller-init.sh" | ||
|
|
||
| do_install() { | ||
| install -d ${D}${bindir} | ||
| install -m 0755 ${WORKDIR}/controller-init.sh ${D}${bindir}/controller-init.sh | ||
| } | ||
|
|
||
| FILES_${PN} = "${bindir}/controller-init.sh" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #!/bin/sh | ||
| echo "Controller node initialized!" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| SUMMARY = "Prometheus Client Library for Modern C++" | ||
| HOMEPAGE = "https://github.com/jupp0r/prometheus-cpp" | ||
| LICENSE = "MIT" | ||
| LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
|
|
||
| SRC_URI = "git://github.com/jupp0r/prometheus-cpp.git;protocol=https;branch=master;destsuffix=git" | ||
| SRCREV = "v1.3.0" | ||
|
|
||
| S = "${WORKDIR}/git" | ||
|
|
||
| DEPENDS = "zlib openssl curl" | ||
|
|
||
| inherit cmake | ||
|
|
||
| EXTRA_OECMAKE = " \ | ||
| -DBUILD_SHARED_LIBS=ON \ | ||
| -DENABLE_PUSH=ON \ | ||
| -DENABLE_TESTING=OFF \ | ||
| -DUSE_THIRDPARTY_LIBRARIES=OFF \ | ||
| -DENABLE_COMPRESSION=OFF \ | ||
| -DOVERRIDE_CATCH=OFF \ | ||
| -DGENERATE_PKGCONFIG=ON \ | ||
| -DENABLE_PULL=OFF \ | ||
| " | ||
|
|
||
| OECMAKE_SOURCEPATH = "${S}" | ||
|
|
||
| do_configure:prepend() { | ||
| bbnote "=== DEBUG: Content of ${S} ===" | ||
| ls -la ${S} | ||
| bbnote "=== Looking for CMakeLists.txt ===" | ||
| find ${S} -name "CMakeLists.txt" -type f | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| SUMMARY = "Go gRPC protocol buffers compiler plugin" | ||
| HOMEPAGE = "https://github.com/grpc/grpc-go" | ||
| LICENSE = "Apache-2.0" | ||
| LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" | ||
|
|
||
| SRC_URI = "git://github.com/grpc/grpc-go.git;branch=master;protocol=https;destsuffix=git" | ||
| SRCREV = "${AUTOREV}" | ||
|
|
||
| S = "${WORKDIR}/git" | ||
|
|
||
| DEPENDS = "go-native" | ||
|
|
||
| GOARCH = "${@ "amd64" if d.getVar('TARGET_ARCH') == "x86_64" else "riscv64"}" | ||
|
|
||
| do_configure[noexec] = "1" | ||
| do_compile[network] = "1" | ||
|
|
||
| do_compile() { | ||
| cd ${S}/cmd/protoc-gen-go-grpc | ||
| GOOS=${TARGET_GOOS} GOARCH=${GOARCH} go build -trimpath -o protoc-gen-go-grpc | ||
| } | ||
|
|
||
| do_install() { | ||
| install -d ${D}${bindir} | ||
| install -m 0755 ${S}/cmd/protoc-gen-go-grpc/protoc-gen-go-grpc ${D}${bindir}/protoc-gen-go-grpc | ||
| } | ||
|
|
||
| INSANE_SKIP:${PN} += "ldflags" | ||
|
|
||
| FILES:${PN} = "${bindir}" | ||
|
|
||
| BBCLASSEXTEND = "native" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| SUMMARY = "Go protocol buffers compiler plugin" | ||
| HOMEPAGE = "https://github.com/golang/protobuf" | ||
| LICENSE = "BSD-3-Clause" | ||
| LIC_FILES_CHKSUM = "file://LICENSE;md5=939cce1ec101726fa754e698ac871622" | ||
|
|
||
| SRC_URI = "git://github.com/golang/protobuf;branch=master;protocol=https;destsuffix=git" | ||
| SRCREV = "${AUTOREV}" | ||
|
|
||
| S = "${WORKDIR}/git" | ||
|
|
||
| DEPENDS = "go-native" | ||
|
|
||
| GOARCH = "${@ "amd64" if d.getVar('TARGET_ARCH') == "x86_64" else "riscv64"}" | ||
|
|
||
| do_configure[noexec] = "1" | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. В do_configure была ошибка проверки хеш суммы, поэтому отключил |
||
| do_compile[network] = "1" | ||
|
|
||
| do_compile() { | ||
| cd ${S} | ||
| if [ -d "cmd/protoc-gen-go" ]; then | ||
| cd cmd/protoc-gen-go | ||
| elif [ -d "protoc-gen-go" ]; then | ||
| cd protoc-gen-go | ||
| else | ||
| bbfatal "Cannot find protoc-gen-go directory" | ||
| fi | ||
| GOOS=${TARGET_GOOS} GOARCH=${GOARCH} go build -trimpath -o protoc-gen-go | ||
| } | ||
|
|
||
| do_install() { | ||
| install -d ${D}${bindir} | ||
| if [ -f ${S}/cmd/protoc-gen-go/protoc-gen-go ]; then | ||
| install -m 0755 ${S}/cmd/protoc-gen-go/protoc-gen-go ${D}${bindir}/protoc-gen-go | ||
| elif [ -f ${S}/protoc-gen-go/protoc-gen-go ]; then | ||
| install -m 0755 ${S}/protoc-gen-go/protoc-gen-go ${D}${bindir}/protoc-gen-go | ||
| else | ||
| bbfatal "protoc-gen-go binary not found" | ||
| fi | ||
| } | ||
|
|
||
| INSANE_SKIP:${PN} += "ldflags" | ||
|
|
||
| FILES:${PN} = "${bindir}" | ||
|
|
||
| BBCLASSEXTEND = "native" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| SUMMARY = "Cluster Unit" | ||
| DESCRIPTION = "A stub package for the cluster unit node" | ||
| LICENSE = "MIT" | ||
| LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
|
|
||
| SRC_URI = "file://unit-init.sh" | ||
|
|
||
| do_install() { | ||
| install -d ${D}${bindir} | ||
| install -m 0755 ${WORKDIR}/unit-init.sh ${D}${bindir}/unit-init.sh | ||
| } | ||
|
|
||
| FILES_${PN} = "${bindir}/unit-init.sh" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #!/bin/sh | ||
| echo "Unit node initialized!" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| SUMMARY = "Worker" | ||
| DESCRIPTION = "Worker program for cluster" | ||
| LICENSE = "MIT" | ||
| LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" | ||
|
|
||
| SRC_URI = "git://github.com/moevm/grpc_server;branch=main;protocol=https;destsuffix=git" | ||
| SRCREV = "3bf8b7841cde8c3c4c684f0ae18ff80f950e7d8b" | ||
|
|
||
| S = "${WORKDIR}/git" | ||
|
|
||
| DEPENDS = "openssl curl prometheus-cpp" | ||
|
|
||
| do_compile() { | ||
| cd ${S}/worker/src | ||
| ${CXX} ${CXXFLAGS} ${LDFLAGS} -o worker \ | ||
| main.cpp md_calculator.cpp file.cpp metrics_collector.cpp worker.cpp \ | ||
| -lssl -lcrypto -lprometheus-cpp-push \ | ||
| -lprometheus-cpp-core -lcurl | ||
| } | ||
|
|
||
| do_install() { | ||
| install -d ${D}${bindir} | ||
| install -m 0755 ${S}/worker/src/worker ${D}${bindir}/worker | ||
| } | ||
|
|
||
| FILES_${PN} = "${bindir}/worker" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Копируется текущая папка meta-cluster, чтобы использовать ее при сборке, а не ту что в репозитории vm_build_risc_v