Skip to content
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

Add support for building rootfs.ext2 #28

Merged
merged 15 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
machine-emulator-tools-*.ext2
example/
rootfs*
.clang-format
.github
.git
*.md
119 changes: 48 additions & 71 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
name: Build
on: [push]
env:
TOOLCHAIN_IMAGE: ${{ github.repository_owner }}/toolchain
TOOLCHAIN_TAG: 0.16.0
jobs:
tools:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest-8-cores
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install libarchive-tools
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install -y --no-install-recommends build-essential autoconf automake libarchive-dev libarchive-tools

# Building from source cause the provided debian package is for Debian Bookworm
- name: Download, build and install xgenext2fs
run: |
mpolitzer marked this conversation as resolved.
Show resolved Hide resolved
wget https://github.com/cartesi/genext2fs/archive/refs/tags/v1.5.3.tar.gz
echo "af62ec69916ffc15fa5921b19630c9935e69a0d8b1bf529d7f26cefdc23a5120 v1.5.3.tar.gz" | sha256sum -c -
tar -xzf v1.5.3.tar.gz
cd genext2fs-1.5.3
./autogen.sh
./configure
make
sudo make install
rm -rf genext2fs-1.5.3 v1.5.3.tar.gz

- name: Login to GHCR
uses: docker/login-action@v2
Expand All @@ -24,111 +36,76 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- uses: actions/checkout@v3
with:
submodules: recursive

- name: Export makefile variables
run: make env >> $GITHUB_ENV

- name: Download and check dependencies
run: make checksum
- name: Create debian package control file
run: make control

- name: Buildx setup
uses: docker/setup-buildx-action@v2

- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ${{ secrets.DOCKER_ORGANIZATION }}/machine-emulator-tools
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}

- name: Build [${{ env.MACHINE_EMULATOR_TOOLS_TAR_GZ }}]
- name: Build [${{ env.TOOLS_DEB }}]
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
tags: ${{ steps.docker_meta.outputs.tags }}
tags: ${{ env.TOOLS_IMAGE }}
push: false
load: true
build-args: |
MACHINE_EMULATOR_TOOLS_TAR_GZ=${{ env.MACHINE_EMULATOR_TOOLS_TAR_GZ }}
MACHINE_EMULATOR_TOOLS_DEB=${{ env.MACHINE_EMULATOR_TOOLS_DEB }}
MACHINE_EMULATOR_TOOLS_VERSION=${{ env.MACHINE_EMULATOR_TOOLS_VERSION }}
LINUX_SOURCES_VERSION=${{ env.LINUX_SOURCES_VERSION }}
LINUX_SOURCES_FILEPATH=${{ env.LINUX_SOURCES_FILEPATH }}
RNDADDENTROPY_VERSION=${{ env.RNDADDENTROPY_VERSION }}
RNDADDENTROPY_FILEPATH=${{ env.RNDADDENTROPY_FILEPATH }}
TOOLS_DEB=${{ env.TOOLS_DEB }}
IMAGE_KERNEL_VERSION=${{ env.IMAGE_KERNEL_VERSION }}
LINUX_VERSION=${{ env.LINUX_VERSION }}
LINUX_HEADERS_URLPATH=${{ env.LINUX_HEADERS_URLPATH }}
cache-from: type=gha,scope=regular,mode=max
cache-to: type=gha,scope=regular

- name: Retrieve artifacts
run: make copy MACHINE_EMULATOR_TOOLS_IMAGE=`echo "${{ steps.docker_meta.outputs.tags }}" | head -1 | cut -d "," -f 1 | xargs`
run: make copy

- name: Upload [${{ env.MACHINE_EMULATOR_TOOLS_TAR_GZ }}]
- name: Build rootfs
run: make fs

- name: Upload [${{ env.TOOLS_DEB }}]
uses: actions/upload-artifact@v3
with:
name: ${{ env.MACHINE_EMULATOR_TOOLS_TAR_GZ }}
path: ${{ env.MACHINE_EMULATOR_TOOLS_TAR_GZ }}
path: ${{ env.TOOLS_DEB }}

- name: Upload [${{ env.MACHINE_EMULATOR_TOOLS_DEB }}]
- name: Upload [${{ env.TOOLS_ROOTFS }}]
uses: actions/upload-artifact@v3
with:
name: ${{ env.MACHINE_EMULATOR_TOOLS_DEB }}
path: ${{ env.MACHINE_EMULATOR_TOOLS_DEB }}
path: ${{ env.TOOLS_ROOTFS }}

- name: Checksum artifacts
if: startsWith(github.ref, 'refs/tags/v')
run: |
sha512sum ${{ env.MACHINE_EMULATOR_TOOLS_DEB }} > ${{ env.MACHINE_EMULATOR_TOOLS_DEB }}.sha512
sha512sum ${{ env.MACHINE_EMULATOR_TOOLS_TAR_GZ }} > ${{ env.MACHINE_EMULATOR_TOOLS_TAR_GZ }}.sha512
sha512sum ${{ env.TOOLS_DEB }} > ${{ env.TOOLS_DEB }}.sha512
sha512sum ${{ env.TOOLS_ROOTFS }} > ${{ env.TOOLS_ROOTFS }}.sha512

- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
prerelease: true
files: |
${{ env.MACHINE_EMULATOR_TOOLS_TAR_GZ }}
${{ env.MACHINE_EMULATOR_TOOLS_TAR_GZ }}.sha512
${{ env.MACHINE_EMULATOR_TOOLS_DEB }}
${{ env.MACHINE_EMULATOR_TOOLS_DEB }}.sha512
${{ env.TOOLS_DEB }}
${{ env.TOOLS_DEB }}.sha512
${{ env.TOOLS_ROOTFS }}
${{ env.TOOLS_ROOTFS }}.sha512

build:
test-rollup-http-server:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build yield tool
run: cd linux/htif && make toolchain-exec CONTAINER_COMMAND="/usr/bin/make yield.toolchain"

- name: Build ioctl-echo-loop tool
run: cd linux/rollup/ioctl-echo-loop && make toolchain-exec CONTAINER_COMMAND="/usr/bin/make ioctl-echo-loop.toolchain"

- name: Build rollup tool
run: cd linux/rollup/rollup && make toolchain-exec CONTAINER_COMMAND="/usr/bin/make rollup.toolchain"

- name: Build rollup http server
run: cd linux/rollup/http/rollup-http-server && ./build.sh

- name: Build echo dapp
run: cd linux/rollup/http/echo-dapp && ./build.sh

- name: Test rollup-http-server and echo-dapp client
run: |
cd linux/rollup/http/rollup-http-server
cd rollup-http/rollup-http-server
USE_ROLLUP_BINDINGS_MOCK=1 cargo test -- --show-output --test-threads=1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
*.ext2
control
machine-emulator-tools-*.tar.gz
machine-emulator-tools-*.deb
dep/
rootfs.*

# Prerequisites
*.d
Expand Down
23 changes: 21 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.14.0] - 2023-12-13
### Changed
- Make rootfs the default target
- Reorganized repository structure
- Use image-kernel Linux headers package
- Cross-compiled sys-utils
- Built rust binaries dependencies in a separate stage
- Cleaned up Dockerfile and Makefile
- Update toolchain to 0.16.0

### Added
- Added support for building rootfs.ext2 (breaking change)
- Added dhrystone and whetstone benchmarks on fs
- Added extra packages to rootfs
- Cross-compiled rust application binaries

### Removed
- Removed example directory

## [0.13.0] - 2023-10-10
### Changed
- Updated tools version in example
- Update toolchain to 0.16.0

### Added
- Added new init system using init and entrypoint from device tree
Expand Down Expand Up @@ -109,7 +127,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [0.2.0]
- [0.1.0]

[Unreleased]: https://github.com/cartesi/machine-emulator-tools/compare/v0.13.0...HEAD
[Unreleased]: https://github.com/cartesi/machine-emulator-tools/compare/v0.14.0...HEAD
[0.14.0]: https://github.com/cartesi/machine-emulator-tools/releases/tag/v0.14.0
[0.13.0]: https://github.com/cartesi/machine-emulator-tools/releases/tag/v0.13.0
[0.12.0]: https://github.com/cartesi/machine-emulator-tools/releases/tag/v0.12.0
[0.11.0]: https://github.com/cartesi/machine-emulator-tools/releases/tag/v0.11.0
Expand Down
Loading