Skip to content

Commit

Permalink
feat!: use new rootfs provided by tools repository
Browse files Browse the repository at this point in the history
  • Loading branch information
vfusco committed Dec 13, 2023
1 parent 652e3d2 commit d969da5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 22 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -163,9 +163,9 @@ jobs:
- name: Download [rootfs.ext2]
uses: Legion2/[email protected]
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/[email protected]
Expand All @@ -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/[email protected]
Expand Down Expand Up @@ -310,9 +310,9 @@ jobs:
- name: Download [rootfs.ext2]
uses: Legion2/[email protected]
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/[email protected]
Expand All @@ -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/[email protected]
Expand Down Expand Up @@ -502,9 +502,9 @@ jobs:
- name: Download [rootfs.ext2]
uses: Legion2/[email protected]
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/[email protected]
Expand All @@ -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/[email protected]
Expand Down Expand Up @@ -600,9 +600,9 @@ jobs:
- name: Download [rootfs.ext2]
uses: Legion2/[email protected]
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/[email protected]
Expand All @@ -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/[email protected]
Expand Down
8 changes: 4 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ endif
# Workload to use in PGO
PGO_WORKLOAD=\
tar c -C / bin | gzip > a.tar.gz && gzip -c a.tar.gz | sha256sum; \
dhrystone 500000; \
whetstone 2500
dhrystone 5000000; \
whetstone 25000

# We ignore test-machine-c-api.cpp cause it takes too long.
# We ignore uarch-pristine-ram.c because it is generated by xxd.
Expand Down Expand Up @@ -277,8 +277,8 @@ CFLAGS+=$(OPTFLAGS) -std=gnu99 -fvisibility=hidden -MMD $(PICCFLAGS) $(CC_MARCH)
LDFLAGS+=$(UBFLAGS)

COVERAGE_WORKLOAD=\
dhrystone 100; \
whetstone 100
dhrystone 1000000; \
whetstone 10000
COVERAGE_CPP_SOURCES=$(wildcard *.cpp)
COVERAGE_SOURCES=$(filter-out %.pb.h, $(wildcard *.h) $(wildcard *.cpp))
ifeq ($(coverage),yes)
Expand Down
15 changes: 14 additions & 1 deletion src/cartesi-machine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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=<string>
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.
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d969da5

Please sign in to comment.