diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d5d9257df..86e5b26b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ on: [push] env: KERNEL_VERSION: v0.19.1 LINUX_VERSION: 6.5.9-ctsi-1-v0.19.1 - ROOTFS_VERSION: v0.19.0 + TOOLS_VERSION: v0.14.0-test1 TEST_VERSION: v0.30.0 CARTESI_TESTS_PATH: /usr/share/cartesi-machine/tests CARTESI_IMAGES_PATH: /usr/share/cartesi-machine/images @@ -163,9 +163,9 @@ jobs: - name: Download [rootfs.ext2] uses: Legion2/download-release-action@v2.1.0 with: - repository: ${{ github.repository_owner }}/image-rootfs - tag: ${{ env.ROOTFS_VERSION }} - file: rootfs-${{ env.ROOTFS_VERSION }}.ext2 + repository: ${{ github.repository_owner }}/machine-emulator-tools + tag: ${{ env.TOOLS_VERSION }} + file: rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 - name: Download [kernel.bin] uses: Legion2/download-release-action@v2.1.0 @@ -179,7 +179,7 @@ jobs: mkdir -m 755 -p ${{ env.CARTESI_IMAGES_PATH }} mv linux-*.bin rootfs-*.ext2 ${{ env.CARTESI_IMAGES_PATH }} cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s linux-${{ env.LINUX_VERSION }}.bin linux.bin - cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s rootfs-${{ env.ROOTFS_VERSION }}.ext2 rootfs.ext2 + cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 rootfs.ext2 - name: Download test suite uses: Legion2/download-release-action@v2.1.0 @@ -310,9 +310,9 @@ jobs: - name: Download [rootfs.ext2] uses: Legion2/download-release-action@v2.1.0 with: - repository: ${{ github.repository_owner }}/image-rootfs - tag: ${{ env.ROOTFS_VERSION }} - file: rootfs-${{ env.ROOTFS_VERSION }}.ext2 + repository: ${{ github.repository_owner }}/machine-emulator-tools + tag: ${{ env.TOOLS_VERSION }} + file: rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 - name: Download [kernel.bin] uses: Legion2/download-release-action@v2.1.0 @@ -326,7 +326,7 @@ jobs: mkdir -m 755 -p ${{ env.CARTESI_IMAGES_PATH }} mv linux-*.bin rootfs-*.ext2 ${{ env.CARTESI_IMAGES_PATH }}/ cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s linux-${{ env.LINUX_VERSION }}.bin linux.bin - cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s rootfs-${{ env.ROOTFS_VERSION }}.ext2 rootfs.ext2 + cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 rootfs.ext2 - name: Download test suite uses: Legion2/download-release-action@v2.1.0 @@ -502,9 +502,9 @@ jobs: - name: Download [rootfs.ext2] uses: Legion2/download-release-action@v2.1.0 with: - repository: ${{ github.repository_owner }}/image-rootfs - tag: ${{ env.ROOTFS_VERSION }} - file: rootfs-${{ env.ROOTFS_VERSION }}.ext2 + repository: ${{ github.repository_owner }}/machine-emulator-tools + tag: ${{ env.TOOLS_VERSION }} + file: rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 - name: Download [kernel.bin] uses: Legion2/download-release-action@v2.1.0 @@ -518,7 +518,7 @@ jobs: mkdir -m 755 -p ${{ env.CARTESI_IMAGES_PATH }} mv linux-*.bin rootfs-*.ext2 ${{ env.CARTESI_IMAGES_PATH }}/ cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s linux-${{ env.LINUX_VERSION }}.bin linux.bin - cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s rootfs-${{ env.ROOTFS_VERSION }}.ext2 rootfs.ext2 + cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 rootfs.ext2 - name: Download test suite uses: Legion2/download-release-action@v2.1.0 @@ -600,9 +600,9 @@ jobs: - name: Download [rootfs.ext2] uses: Legion2/download-release-action@v2.1.0 with: - repository: ${{ github.repository_owner }}/image-rootfs - tag: ${{ env.ROOTFS_VERSION }} - file: rootfs-${{ env.ROOTFS_VERSION }}.ext2 + repository: ${{ github.repository_owner }}/machine-emulator-tools + tag: ${{ env.TOOLS_VERSION }} + file: rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 - name: Download [kernel.bin] uses: Legion2/download-release-action@v2.1.0 @@ -616,7 +616,7 @@ jobs: mkdir -m 755 -p ${{ env.CARTESI_IMAGES_PATH }} mv linux-*.bin rootfs-*.ext2 ${{ env.CARTESI_IMAGES_PATH }}/ cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s linux-${{ env.LINUX_VERSION }}.bin linux.bin - cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s rootfs-${{ env.ROOTFS_VERSION }}.ext2 rootfs.ext2 + cd ${{ env.CARTESI_IMAGES_PATH }} && ln -s rootfs-tools-${{ env.TOOLS_VERSION }}.ext2 rootfs.ext2 - name: Download test suite uses: Legion2/download-release-action@v2.1.0 diff --git a/src/cartesi-machine.lua b/src/cartesi-machine.lua index 694232e9c..3239cc2ae 100755 --- a/src/cartesi-machine.lua +++ b/src/cartesi-machine.lua @@ -360,6 +360,9 @@ where options are: --no-init-splash don't show cartesi machine splash on boot. + --no-default-init + don't use cartesi machine default init value (USER=dapp) + --append-init= append a command to machine's init script to be executed with root privilege. The command is executed on boot after mounting flash drives and before running the entrypoint. @@ -438,9 +441,10 @@ local memory_range_replace = {} local ram_image_filename = images_path .. "linux.bin" local ram_length = 64 << 20 local dtb_image_filename = nil -local bootargs = "quiet earlycon=sbi console=hvc0 rootfstype=ext2 root=/dev/pmem0 rw init=/opt/cartesi/bin/init" +local bootargs = "quiet earlycon=sbi console=hvc0 rootfstype=ext2 root=/dev/pmem0 rw init=/usr/sbin/cartesi-init" local init_splash = true local append_bootargs = "" +local default_init = "USER=dapp\n" local append_init = "" local append_entrypoint = "" local rollup = { @@ -1131,6 +1135,14 @@ local options = { return true end, }, + { + "^%-%-no%-default%-init$", + function(all) + if not all then return false end + default_init = "" + return true + end, + }, { "^%-%-append%-init%=(.*)$", function(o) @@ -1535,6 +1547,7 @@ echo " end if #append_bootargs > 0 then config.dtb.bootargs = config.dtb.bootargs .. " " .. append_bootargs end + if #default_init > 0 then config.dtb.init = config.dtb.init .. default_init end if #append_init > 0 then config.dtb.init = config.dtb.init .. append_init end if #append_entrypoint > 0 then config.dtb.entrypoint = config.dtb.entrypoint .. append_entrypoint end if #exec_arguments > 0 then config.dtb.entrypoint = config.dtb.entrypoint .. table.concat(exec_arguments, " ") end