Skip to content

Commit 8fdff99

Browse files
committed
feat: add auto-generated license info for rootfs
1 parent 613f7cf commit 8fdff99

File tree

12 files changed

+476
-369
lines changed

12 files changed

+476
-369
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ libcmt*
55
.github
66
.git
77
*.md
8+
fs

.github/workflows/main.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build
22
on: [push]
33
jobs:
44
build:
5-
needs: [test]
5+
# needs: [test]
66
runs-on: ubuntu-latest-8-cores
77
steps:
88
- name: Install libarchive-tools
@@ -50,6 +50,9 @@ jobs:
5050
- name: Create version file
5151
run: make package.json
5252

53+
- name: Set up QEMU
54+
uses: docker/setup-qemu-action@v3
55+
5356
- name: Buildx setup
5457
uses: docker/setup-buildx-action@v3
5558

@@ -73,8 +76,8 @@ jobs:
7376
- name: Retrieve artifacts
7477
run: make copy
7578

76-
- name: Build rootfs
77-
run: make fs
79+
- name: Build rootfs and license information
80+
run: make fs-and-license
7881

7982
- name: Build libcmt
8083
id: docker_build_libcmt
@@ -101,6 +104,7 @@ jobs:
101104
path: |
102105
${{ env.TOOLS_DEB }}
103106
${{ env.TOOLS_ROOTFS }}
107+
${{ env.TOOLS_ROOTFS }}.md
104108
libcmt/deb/*
105109
106110
- name: Checksum artifacts
@@ -118,6 +122,7 @@ jobs:
118122
${{ env.TOOLS_DEB }}
119123
${{ env.TOOLS_DEB }}.sha512
120124
${{ env.TOOLS_ROOTFS }}
125+
${{ env.TOOLS_ROOTFS }}.md
121126
${{ env.TOOLS_ROOTFS }}.sha512
122127
libcmt/deb/*
123128

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Changed
99
- Bump dependencies versions
10+
- Added rootfs.ext2:/etc/LICENSES file listing licenses of all installed packages
1011

1112
## [0.16.1] - 2024-08-12
1213
### Fixed

Makefile

+17-4
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616

1717
MAJOR := 0
1818
MINOR := 16
19-
PATCH := 1
19+
PATCH := 2
2020
LABEL :=
2121
VERSION := $(MAJOR).$(MINOR).$(PATCH)$(LABEL)
2222

2323
TOOLS_DEB := machine-emulator-tools-v$(VERSION).deb
2424
TOOLS_IMAGE := cartesi/machine-emulator-tools:$(VERSION)
2525
TOOLS_ROOTFS := rootfs-tools-v$(VERSION).ext2
26+
TOOLS_ROOTFS_IMAGE := cartesi/rootfs-tools:$(VERSION)
2627

2728
IMAGE_KERNEL_VERSION ?= v0.20.0
2829
LINUX_VERSION ?= 6.5.13-ctsi-1
@@ -53,15 +54,25 @@ control: Makefile control.in
5354
package.json: Makefile package.json.in
5455
@sed 's|ARG_VERSION|$(VERSION)|g' package.json.in > package.json
5556

56-
$(TOOLS_ROOTFS) fs: $(TOOLS_DEB)
57-
@docker buildx build --platform=linux/riscv64 \
57+
fs: $(TOOLS_ROOTFS)
58+
59+
$(TOOLS_ROOTFS): $(TOOLS_DEB)
60+
@docker buildx build --platform linux/riscv64 \
5861
--build-arg TOOLS_DEB=$(TOOLS_DEB) \
5962
--output type=tar,dest=rootfs.tar \
6063
--file fs/Dockerfile \
6164
. && \
6265
xgenext2fs -fzB 4096 -b 25600 -i 4096 -a rootfs.tar -L rootfs $(TOOLS_ROOTFS) && \
6366
rm -f rootfs.tar
6467

68+
fs-and-license: $(TOOLS_ROOTFS)
69+
@docker buildx build --load --platform linux/riscv64 \
70+
--build-arg TOOLS_DEB=$(TOOLS_DEB) \
71+
-t $(TOOLS_ROOTFS_IMAGE) \
72+
--file fs/Dockerfile \
73+
.
74+
(cd fs/third-party/repo-info/; ./scan-local.sh $(TOOLS_ROOTFS_IMAGE) linux/riscv64) | tee $(TOOLS_ROOTFS).md
75+
6576
libcmt:
6677
@mkdir $@
6778

@@ -84,6 +95,7 @@ env:
8495
@echo TOOLS_DEB=$(TOOLS_DEB)
8596
@echo TOOLS_ROOTFS=$(TOOLS_ROOTFS)
8697
@echo TOOLS_IMAGE=$(TOOLS_IMAGE)
98+
@echo TOOLS_ROOTFS_IMAGE=$(TOOLS_ROOTFS_IMAGE)
8799
@echo IMAGE_KERNEL_VERSION=$(IMAGE_KERNEL_VERSION)
88100
@echo LINUX_VERSION=$(LINUX_VERSION)
89101
@echo LINUX_HEADERS_URLPATH=$(LINUX_HEADERS_URLPATH)
@@ -142,10 +154,11 @@ help:
142154
@echo 'available commands:'
143155
@echo ' deb - build machine-emulator-tools .deb package'
144156
@echo ' fs - build rootfs.ext2'
157+
@echo ' fs-and-license - build rootfs.ext2 and rootfs.ext2.md'
145158
@echo ' setup - setup riscv64 buildx'
146159
@echo ' setup-required - check if riscv64 buildx setup is required'
147160
@echo ' help - list makefile commands'
148161
@echo ' env - print useful Makefile variables as a KEY=VALUE list'
149162
@echo ' clean - remove the generated artifacts'
150163

151-
.PHONY: build fs deb build-libcmt env setup setup-required help distclean
164+
.PHONY: build fs fs-and-license deb build-libcmt env setup setup-required help distclean

fs/.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
third-party

fs/Dockerfile

+17-49
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,22 @@
1-
FROM --platform=$BUILDPLATFORM ubuntu:22.04 AS cross-builder
2-
ENV BUILD_BASE=/tmp/build-extra
3-
4-
# Install dependencies
5-
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
6-
apt-get install -y --no-install-recommends \
7-
ca-certificates \
8-
wget \
9-
patch \
10-
libdigest-sha-perl \
11-
libc6-dev-riscv64-cross \
12-
gcc-12-riscv64-linux-gnu \
13-
&& \
14-
adduser developer -u 499 --gecos ",,," --disabled-password && \
15-
mkdir -p ${BUILD_BASE} && chown -R developer:developer ${BUILD_BASE} && \
16-
rm -rf /var/lib/apt/lists/*
17-
18-
USER developer
19-
WORKDIR ${BUILD_BASE}
20-
21-
# Build benchmark binaries
22-
COPY fs/dhrystone.patch ${BUILD_BASE}/
23-
COPY fs/shasumfile ${BUILD_BASE}/
24-
RUN mkdir benchmarks && cd benchmarks && \
25-
wget https://www.netlib.org/benchmark/whetstone.c https://www.netlib.org/benchmark/dhry-c && \
26-
shasum -ca 256 ../shasumfile &&\
27-
bash dhry-c && \
28-
patch -p1 < ../dhrystone.patch && \
29-
riscv64-linux-gnu-gcc-12 -O2 -o whetstone whetstone.c -lm && \
30-
riscv64-linux-gnu-gcc-12 -O2 -o dhrystone dhry_1.c dhry_2.c -lm
31-
321
# Final image
33-
FROM --platform=linux/riscv64 riscv64/ubuntu:22.04
34-
ARG TOOLS_DEB=machine-emulator-tools-v0.15.0.deb
2+
FROM --platform=$TARGETPLATFORM ubuntu:22.04
3+
ARG TOOLS_DEB=machine-emulator-tools-v0.16.2.deb
354
ADD ${TOOLS_DEB} /tmp/
365
RUN apt-get update && \
37-
apt-get install -y --no-install-recommends \
38-
busybox-static=1:1.30.1-7ubuntu3 \
39-
coreutils=8.32-4.1ubuntu1.2 \
40-
bash=5.1-6ubuntu1.1 \
41-
psmisc=23.4-2build3 \
42-
bc=1.07.1-3build1 \
43-
curl=7.81.0-1ubuntu1.18 \
44-
device-tree-compiler=1.6.1-1 \
45-
jq=1.6-2.1ubuntu3 \
46-
lua5.4=5.4.4-1 \
47-
lua-socket=3.0~rc1+git+ac3201d-6 \
48-
xxd=2:8.2.3995-1ubuntu2.18 \
49-
file=1:5.41-3ubuntu0.1 \
50-
/tmp/${TOOLS_DEB} \
6+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
7+
busybox-static=1:1.30.1-7ubuntu3 \
8+
coreutils=8.32-4.1ubuntu1.2 \
9+
bash=5.1-6ubuntu1.1 \
10+
psmisc=23.4-2build3 \
11+
bc=1.07.1-3build1 \
12+
curl=7.81.0-1ubuntu1.18 \
13+
device-tree-compiler=1.6.1-1 \
14+
jq=1.6-2.1ubuntu3 \
15+
lua5.4=5.4.4-1 \
16+
lua-socket=3.0~rc1+git+ac3201d-6 \
17+
xxd=2:8.2.3995-1ubuntu2.18 \
18+
file=1:5.41-3ubuntu0.1 \
19+
stress-ng=0.13.12-2ubuntu1 \
20+
/tmp/${TOOLS_DEB} \
5121
&& \
5222
rm -rf /var/lib/apt/lists/* /tmp/${TOOLS_DEB}
53-
COPY --chown=root:root --from=cross-builder /tmp/build-extra/benchmarks/whetstone /usr/bin/
54-
COPY --chown=root:root --from=cross-builder /tmp/build-extra/benchmarks/dhrystone /usr/bin/

0 commit comments

Comments
 (0)