diff --git a/.gitmodules b/.gitmodules index cefbcdc..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "tools"] - path = tools - url = ../machine-emulator-tools.git diff --git a/Dockerfile b/Dockerfile index 041ee3f..dc84c26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,8 +47,6 @@ COPY skel $BUILD_BASE/buildroot/skel COPY cartesi-buildroot-config $BUILD_BASE/buildroot COPY cartesi-busybox-fragment $BUILD_BASE/buildroot COPY patches $BUILD_BASE/buildroot/patches -COPY tools/linux/htif/yield $BUILD_BASE/buildroot/skel/opt/cartesi/bin/ -COPY tools/linux/utils $BUILD_BASE/buildroot/skel/opt/cartesi/bin # Never use -jN with buildroot RUN \ diff --git a/Makefile b/Makefile index dbd4983..8778ade 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,6 @@ IMG_REPO:=cartesi/rootfs IMG:=$(IMG_REPO):$(TAG) BASE:=/opt/riscv ART:=$(BASE)/rootfs/artifacts/rootfs.ext2 -YIELD_BIN:=tools/linux/htif/yield ifneq ($(TOOLCHAIN_TAG),) BUILD_ARGS := --build-arg TOOLCHAIN_VERSION=$(TOOLCHAIN_TAG) @@ -33,15 +32,7 @@ endif all: copy -submodules: - git submodule update --init --recursive - -$(YIELD_BIN): - $(MAKE) -C tools/linux/htif TOOLCHAIN_TAG=$(TOOLCHAIN_TAG) - -yield: $(YIELD_BIN) - -build: $(YIELD_BIN) cartesi-buildroot-config cartesi-busybox-fragment +build: cartesi-buildroot-config cartesi-busybox-fragment docker build -t $(IMG) $(BUILD_ARGS) . push: @@ -79,7 +70,6 @@ clean-config: rm -f ./cartesi-buildroot-config ./cartesi-busybox-fragment clean: clean-config - $(MAKE) -C tools/linux/htif TOOLCHAIN_TAG=$(TOOLCHAIN_TAG) clean rm -f rootfs.ext2 copy: build diff --git a/configs/default-buildroot-config b/configs/default-buildroot-config index 9f6ce97..ff4a7c0 100644 --- a/configs/default-buildroot-config +++ b/configs/default-buildroot-config @@ -230,6 +230,7 @@ BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_5=y # BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_1 is not set # BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_0 is not set # BR2_TOOLCHAIN_EXTERNAL_HEADERS_REALLY_OLD is not set +BR2_TOOLCHAIN_EXTERNAL_HAS_CARTESI_KERNEL_HEADERS=y # BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC is not set BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y # BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL is not set @@ -2298,7 +2299,7 @@ BR2_PACKAGE_GNUPG2=y # # System tools # -# BR2_PACKAGE_ACL is not set +BR2_PACKAGE_ACL=y # BR2_PACKAGE_ANDROID_TOOLS is not set # BR2_PACKAGE_ATOP is not set BR2_PACKAGE_ATTR=y @@ -2436,6 +2437,11 @@ BR2_PACKAGE_UTIL_LINUX_WDCTL=y BR2_PACKAGE_UTIL_LINUX_WRITE=y BR2_PACKAGE_UTIL_LINUX_ZRAMCTL=y # BR2_PACKAGE_XDG_DBUS_PROXY is not set +BR2_PACKAGE_MACHINE_EMULATOR_TOOLS=y +BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_YIELD=y +BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_FLASHDRIVE=y +BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_READBE64=y +BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_WRITEBE64=y # # Text editors and viewers diff --git a/configs/min-buildroot-config b/configs/min-buildroot-config index d266c67..8dfaece 100644 --- a/configs/min-buildroot-config +++ b/configs/min-buildroot-config @@ -2297,7 +2297,7 @@ BR2_PACKAGE_GNUPG2=y # # System tools # -# BR2_PACKAGE_ACL is not set +BR2_PACKAGE_ACL=y # BR2_PACKAGE_ANDROID_TOOLS is not set # BR2_PACKAGE_ATOP is not set BR2_PACKAGE_ATTR=y @@ -2435,6 +2435,11 @@ BR2_PACKAGE_UTIL_LINUX_WDCTL=y BR2_PACKAGE_UTIL_LINUX_WRITE=y BR2_PACKAGE_UTIL_LINUX_ZRAMCTL=y # BR2_PACKAGE_XDG_DBUS_PROXY is not set +BR2_PACKAGE_MACHINE_EMULATOR_TOOLS=y +BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_YIELD=y +BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_FLASHDRIVE=y +BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_READBE64=y +BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_WRITEBE64=y # # Text editors and viewers diff --git a/patches/0007-add-machine-emulator-tools.patch b/patches/0007-add-machine-emulator-tools.patch new file mode 100644 index 0000000..bd0b340 --- /dev/null +++ b/patches/0007-add-machine-emulator-tools.patch @@ -0,0 +1,130 @@ +diff --git a/package/Config.in b/package/Config.in +--- a/package/Config.in ++++ b/package/Config.in +@@ -2424,6 +2427,7 @@ menu "System tools" + source "package/xdg-dbus-proxy/Config.in" + source "package/xen/Config.in" + source "package/xvisor/Config.in" ++ source "package/machine-emulator-tools/Config.in" + endmenu + + menu "Text editors and viewers" +diff --git a/package/machine-emulator-tools/Config.in b/package/machine-emulator-tools/Config.in +new file mode 100644 +--- /dev/null ++++ b/package/machine-emulator-tools/Config.in +@@ -0,0 +1,35 @@ ++menuconfig BR2_PACKAGE_MACHINE_EMULATOR_TOOLS ++ bool "Cartesi machine-emulator-tools" ++ help ++ Various useful Cartesi machine libraries and utilities. ++ ++ Things like yield, flashdrive, readbe64, writebe64, etc... ++ ++ https://github.com/cartesi/machine-emulator-tools/ ++ ++if BR2_PACKAGE_MACHINE_EMULATOR_TOOLS ++ ++config BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_YIELD ++ bool "yield" ++ depends on BR2_TOOLCHAIN_EXTERNAL_HAS_CARTESI_KERNEL_HEADERS ++ help ++ Install yield command line utility. ++ ++config BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_FLASHDRIVE ++ bool "flashdrive" ++ help ++ Install flashdrive command line utility. ++ ++config BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_READBE64 ++ bool "readbe64" ++ depends on BR2_PACKAGE_LUA_5_3 ++ help ++ Install readbe64 command line utility. ++ ++config BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_WRITEBE64 ++ bool "writebe64" ++ depends on BR2_PACKAGE_LUA_5_3 ++ help ++ Install writebe64 command line utility. ++ ++endif +diff --git a/package/machine-emulator-tools/machine-emulator-tools.hash b/package/machine-emulator-tools/machine-emulator-tools.hash +new file mode 100644 +--- /dev/null ++++ b/package/machine-emulator-tools/machine-emulator-tools.hash +@@ -0,0 +1 @@ ++sha256 11d50c4cffe8e1191ca0427e3fde62a79dc8df93cce2048312690d7c484f7111 v0.2.0.tar.gz +diff --git a/package/machine-emulator-tools/machine-emulator-tools.mk b/package/machine-emulator-tools/machine-emulator-tools.mk +new file mode 100644 +--- /dev/null ++++ b/package/machine-emulator-tools/machine-emulator-tools.mk +@@ -0,0 +1,54 @@ ++################################################################################ ++# ++# machine-emulator-tools ++# ++################################################################################ ++ ++MACHINE_EMULATOR_TOOLS_VERSION = v0.2.0 ++MACHINE_EMULATOR_TOOLS_SOURCE = $(MACHINE_EMULATOR_TOOLS_VERSION).tar.gz ++MACHINE_EMULATOR_TOOLS_SITE = https://github.com/cartesi/machine-emulator-tools/archive ++MACHINE_EMULATOR_TOOLS_LICENSE = Apache-2.0 ++MACHINE_EMULATOR_TOOLS_LICENSE_FILES = LICENSE ++MACHINE_EMULATOR_TOOLS_INSTALL_STAGING = NO ++ ++ifeq ($(BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_YIELD),y) ++define BUILD_MACHINE_EMULATOR_TOOLS_YIELD ++ $(MAKE) RVCC=$(TARGET_CC) -C $(@D)/linux/htif yield.toolchain ++endef ++define INSTALL_MACHINE_EMULATOR_TOOLS_YIELD ++ $(INSTALL) -D -m 0755 $(@D)/linux/htif/yield $(TARGET_DIR)/opt/cartesi/bin/yield ++endef ++endif ++ ++MACHINE_EMULATOR_TOOLS_UTILS = ++ ++ifeq ($(BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_FLASHDRIVE),y) ++MACHINE_EMULATOR_TOOLS_UTILS += flashdrive ++endif ++ ++ifeq ($(BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_READBE64),y) ++MACHINE_EMULATOR_TOOLS_UTILS += readbe64 ++endif ++ ++ifeq ($(BR2_PACKAGE_MACHINE_EMULATOR_TOOLS_WRITEBE64),y) ++MACHINE_EMULATOR_TOOLS_UTILS += writebe64 ++endif ++ ++ifneq ($(MACHINE_EMULATOR_TOOLS_UTILS),) ++define INSTALL_MACHINE_EMULATOR_UTILS ++ for f in $(MACHINE_EMULATOR_TOOLS_UTILS); do \ ++ $(INSTALL) -D -m 0755 $(@D)/linux/utils/$$f $(TARGET_DIR)/opt/cartesi/bin/$$f ; \ ++ done ++endef ++endif ++ ++define MACHINE_EMULATOR_TOOLS_BUILD_CMDS ++ $(BUILD_MACHINE_EMULATOR_TOOLS_YIELD) ++endef ++ ++define MACHINE_EMULATOR_TOOLS_INSTALL_TARGET_CMDS ++ $(INSTALL_MACHINE_EMULATOR_TOOLS_YIELD) ++ $(INSTALL_MACHINE_EMULATOR_UTILS) ++endef ++ ++$(eval $(generic-package)) +diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options +--- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options ++++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options +@@ -323,6 +323,10 @@ endchoice + comment "Kernel headers older than 3.13 is not tested by Buildroot. Use at your own risk." + depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13 + ++config BR2_TOOLCHAIN_EXTERNAL_HAS_CARTESI_KERNEL_HEADERS ++ bool "External toolchain has Cartesi kernel headers?" ++ depends on (BR2_riscv && BR2_RISCV_64) ++ + choice + prompt "External toolchain C library" + default BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC diff --git a/tools b/tools deleted file mode 160000 index 3e77574..0000000 --- a/tools +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3e77574bf11f927b8f7b866060a1d9faec499c8e