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

feat: bump to Ubuntu 24.04 #85

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
24 changes: 7 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#

FROM ubuntu:22.04 AS tools-env
FROM ubuntu:24.04 AS tools-env
ARG IMAGE_KERNEL_VERSION=v0.20.0
ARG LINUX_VERSION=6.5.13-ctsi-1
ARG LINUX_HEADERS_URLPATH=https://github.com/cartesi/image-kernel/releases/download/${IMAGE_KERNEL_VERSION}/linux-libc-dev-riscv64-cross-${LINUX_VERSION}-${IMAGE_KERNEL_VERSION}.deb
Expand All @@ -32,38 +32,28 @@ apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends \
dpkg-dev \
g++-12 \
gcc-12 \
g++ \
gcc \
make \
ca-certificates \
git \
wget \
adduser \
libclang-dev \
pkg-config \
dpkg-cross \
gcc-12-riscv64-linux-gnu \
g++-12-riscv64-linux-gnu

for tool in cpp g++ gcc gcc-ar gcc-nm gcc-ranlib gcov gcov-dump gcov-tool; do
update-alternatives --install /usr/bin/riscv64-linux-gnu-$tool riscv64-linux-gnu-$tool /usr/bin/riscv64-linux-gnu-$tool-12 12
update-alternatives --install /usr/bin/$tool $tool /usr/bin/$tool-12 12
done
update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-12 12
gcc-riscv64-linux-gnu \
g++-riscv64-linux-gnu

wget -O ${LINUX_HEADERS_FILEPATH} ${LINUX_HEADERS_URLPATH}
echo "2723435e8b45d8fb7a79e9344f6dc517b3dbc08e03ac17baab311300ec475c08 ${LINUX_HEADERS_FILEPATH}" | sha256sum --check
apt-get install -y --no-install-recommends ${LINUX_HEADERS_FILEPATH}
apt-get install -y --no-install-recommends --allow-downgrades ${LINUX_HEADERS_FILEPATH}

adduser developer -u 499 --gecos ",,," --disabled-password
mkdir -p ${BUILD_BASE}/tools && chown -R developer:developer ${BUILD_BASE}/tools
rm -rf /var/lib/apt/lists/* ${LINUX_HEADERS_FILEPATH}
EOF

ENV RISCV_ARCH="rv64gc"
ENV RISCV_ABI="lp64d"
ENV CFLAGS="-march=$RISCV_ARCH -mabi=$RISCV_ABI"
ENV TOOLCHAIN_PREFIX="riscv64-linux-gnu-"

FROM tools-env AS builder
COPY --chown=developer:developer sys-utils/ ${BUILD_BASE}/tools/sys-utils/

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ $(TOOLS_ROOTFS): $(TOOLS_DEB)
--output type=tar,dest=rootfs.tar \
--file fs/Dockerfile \
. && \
xgenext2fs -fzB 4096 -b 25600 -i 4096 -a rootfs.tar -L rootfs $(TOOLS_ROOTFS) && \
xgenext2fs -fzB 4096 -i 4096 -r +4096 -a rootfs.tar -L rootfs $(TOOLS_ROOTFS) && \
rm -f rootfs.tar

fs-license:
Expand Down
29 changes: 15 additions & 14 deletions fs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Final image
FROM --platform=linux/riscv64 ubuntu:22.04
FROM ubuntu:24.04
ARG TOOLS_DEB=machine-emulator-tools-v0.16.2.deb
ADD ${TOOLS_DEB} /tmp/
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
busybox-static=1:1.30.1-7ubuntu3 \
coreutils=8.32-4.1ubuntu1.2 \
bash=5.1-6ubuntu1.1 \
psmisc=23.4-2build3 \
bc=1.07.1-3build1 \
curl=7.81.0-1ubuntu1.18 \
device-tree-compiler=1.6.1-1 \
jq=1.6-2.1ubuntu3 \
lua5.4=5.4.4-1 \
lua-socket=3.0~rc1+git+ac3201d-6 \
xxd=2:8.2.3995-1ubuntu2.19 \
file=1:5.41-3ubuntu0.1 \
stress-ng=0.13.12-2ubuntu1 \
busybox-static=1:1.36.1-6ubuntu3.1 \
coreutils=9.4-3ubuntu6 \
bash=5.2.21-2ubuntu4 \
psmisc=23.7-1build1 \
bc=1.07.1-3ubuntu4 \
curl=8.5.0-2ubuntu10.4 \
device-tree-compiler=1.7.0-2build1 \
jq=1.7.1-3build1 \
lua5.4=5.4.6-3build2 \
lua-socket=3.1.0-1 \
xxd=2:9.1.0016-1ubuntu7.3 \
file=1:5.45-3build1 \
stress-ng=0.17.06-1build1 \
libatomic1=14.2.0-4ubuntu2~24.04 \
/tmp/${TOOLS_DEB} \
&& \
rm -rf /var/lib/apt/lists/* /tmp/${TOOLS_DEB}
2 changes: 1 addition & 1 deletion rollup-http/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[target.riscv64gc-unknown-linux-gnu]
linker = "riscv64-linux-gnu-gcc-12"
linker = "riscv64-linux-gnu-gcc"

[net]
git-fetch-with-cli = true
10 changes: 1 addition & 9 deletions sys-utils/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,13 @@


UTILITIES := hex xhalt yield rollup ioctl-echo-loop
UTILITIES_WITH_TOOLCHAIN := $(addsuffix -with-toolchain,$(UTILITIES))

all: $(UTILITIES)

$(UTILITIES):
@$(MAKE) -C $@

with-toolchain:
@$(MAKE) $(UTILITIES_WITH_TOOLCHAIN)

$(UTILITIES_WITH_TOOLCHAIN):
@$(MAKE) -C $@ with-toolchain

clean:
@$(foreach utility,$(UTILITIES),$(MAKE) -C $(utility) clean;)


.PHONY: all with-toolchain $(UTILITIES) $(UTILITIES_WITH_TOOLCHAIN)
.PHONY: all $(UTILITIES)
63 changes: 8 additions & 55 deletions sys-utils/hex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,65 +14,18 @@
# limitations under the License.
#

UNAME:=$(shell uname)
TOOLCHAIN_PREFIX ?= riscv64-linux-gnu-

TOOLCHAIN_IMAGE ?= cartesi/toolchain
TOOLCHAIN_TAG ?= 0.16.0
RISCV_ARCH ?= rv64gc
RISCV_ABI ?= lp64d

TOOLCHAIN_PREFIX ?= riscv64-cartesi-linux-gnu-

RVCC = $(TOOLCHAIN_PREFIX)gcc
RVCXX = $(TOOLCHAIN_PREFIX)g++
RVCOPY = $(TOOLCHAIN_PREFIX)objcopy
RVDUMP = $(TOOLCHAIN_PREFIX)objdump
STRIP = $(TOOLCHAIN_PREFIX)strip
RISCV_CFLAGS :=-march=$(RISCV_ARCH) -mabi=$(RISCV_ABI)

CONTAINER_MAKE := /usr/bin/make
CONTAINER_BASE := /opt/cartesi/tools
KERNEL_HEADERS_PATH := /opt/riscv/usr/include
CXX = $(TOOLCHAIN_PREFIX)g++
STRIP = $(TOOLCHAIN_PREFIX)strip
CXXFLAGS = -Wall -Wextra -pedantic -O2 -std=c++20
LDFLAGS =

all: hex

hex.with-toolchain with-toolchain:
$(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) [email protected]"

extra.ext2.with-toolchain:
$(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) [email protected]"

hex: hex.cpp
$(RVCXX) -O2 -o hex hex.cpp
$(STRIP) hex

extra.ext2: hex
mkdir -m 0755 ./extra
cp ./hex ./extra/hex
xgenext2fs -i 512 -b 8192 -d extra $(basename $@)
rm -rf ./extra

toolchain-exec:
@docker run --hostname $@ --rm \
-e USER=$$(id -u -n) \
-e GROUP=$$(id -g -n) \
-e UID=$$(id -u) \
-e GID=$$(id -g) \
-v `pwd`:$(CONTAINER_BASE) \
-w $(CONTAINER_BASE) \
$(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) $(CONTAINER_COMMAND)

toolchain-env:
@docker run --hostname toolchain-env -it --rm \
-e USER=$$(id -u -n) \
-e GROUP=$$(id -g -n) \
-e UID=$$(id -u) \
-e GID=$$(id -g) \
-v `pwd`:$(CONTAINER_BASE) \
-w $(CONTAINER_BASE) \
$(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG)
$(CXX) $(CFLAGS) -o $@ $< $(LDFLAGS)
$(STRIP) $@

clean:
@rm -rf hex extra.ext2 extra

.PHONY: toolchain-exec toolchain-env
@rm -rf hex
41 changes: 0 additions & 41 deletions sys-utils/hex/README.md

This file was deleted.

67 changes: 10 additions & 57 deletions sys-utils/ioctl-echo-loop/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,67 +14,20 @@
# limitations under the License.
#

UNAME:=$(shell uname)
TOOLCHAIN_PREFIX ?= riscv64-linux-gnu-
PKG_CONFIG_PATH = /usr/riscv64-linux-gnu/lib/pkgconfig
export PKG_CONFIG_PATH

TOOLCHAIN_IMAGE ?= cartesi/toolchain
TOOLCHAIN_TAG ?= 0.16.0
RISCV_ARCH ?= rv64gc
RISCV_ABI ?= lp64d

TOOLCHAIN_PREFIX ?= riscv64-cartesi-linux-gnu-

RVCC = $(TOOLCHAIN_PREFIX)gcc
RVCXX = $(TOOLCHAIN_PREFIX)g++
RVCOPY = $(TOOLCHAIN_PREFIX)objcopy
RVDUMP = $(TOOLCHAIN_PREFIX)objdump
STRIP = $(TOOLCHAIN_PREFIX)strip
CFLAGS +=-Wall -Wextra -pedantic -O2 `pkg-config --cflags libcmt`
LDLIBS += `pkg-config --libs libcmt`

CONTAINER_MAKE := /usr/bin/make
CONTAINER_BASE := /opt/cartesi/tools
KERNEL_HEADERS_PATH := /opt/riscv/usr/include
CC = $(TOOLCHAIN_PREFIX)gcc
STRIP = $(TOOLCHAIN_PREFIX)strip
CFLAGS = -Wall -Wextra -pedantic -O2 `pkg-config --cflags libcmt`
LDFLAGS = `pkg-config --libs libcmt`

all: ioctl-echo-loop

ioctl-echo-loop.with-toolchain with-toolchain:
$(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) [email protected]"

extra.ext2.with-toolchain:
$(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) [email protected]"

ioctl-echo-loop: export PKG_CONFIG_PATH ?= /usr/riscv64-linux-gnu/lib/pkgconfig
ioctl-echo-loop: ioctl-echo-loop.c
$(RVCC) $(CFLAGS) -o ioctl-echo-loop ioctl-echo-loop.c $(LDLIBS)
$(STRIP) ioctl-echo-loop

extra.ext2: ioctl-echo-loop
mkdir -m 0755 ./extra
cp ./ioctl-echo-loop ./extra/ioctl-echo-loop
xgenext2fs -i 512 -b 8192 -d extra $(basename $@)
rm -rf ./extra

toolchain-exec:
@docker run --hostname $@ --rm \
-e USER=$$(id -u -n) \
-e GROUP=$$(id -g -n) \
-e UID=$$(id -u) \
-e GID=$$(id -g) \
-v `pwd`:$(CONTAINER_BASE) \
-w $(CONTAINER_BASE) \
$(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) $(CONTAINER_COMMAND)

toolchain-env:
@docker run --hostname toolchain-env -it --rm \
-e USER=$$(id -u -n) \
-e GROUP=$$(id -g -n) \
-e UID=$$(id -u) \
-e GID=$$(id -g) \
-v `pwd`:$(CONTAINER_BASE) \
-w $(CONTAINER_BASE) \
$(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG)
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
$(STRIP) $@

clean:
@rm -rf ioctl-echo-loop extra.ext2 extra

.PHONY: toolchain-exec toolchain-env
@rm -f ioctl-echo-loop
3 changes: 3 additions & 0 deletions sys-utils/libcmt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TARGET_PREFIX ?= $(PREFIX)
TOOLCHAIN_PREFIX ?= riscv64-linux-gnu-
TARGET_CC := $(TOOLCHAIN_PREFIX)gcc
TARGET_AR := $(TOOLCHAIN_PREFIX)ar
TARGET_STRIP := $(TOOLCHAIN_PREFIX)strip
COMMON_CFLAGS := -Wvla -O2 -g -Wall -pedantic -Wextra -Iinclude \
-fno-strict-aliasing -fno-strict-overflow -fPIC
TARGET_CFLAGS := $(COMMON_CFLAGS) -ftrivial-auto-var-init=zero -Wstrict-aliasing=3
Expand Down Expand Up @@ -77,10 +78,12 @@ libcmt: $(libcmt_LIB) $(libcmt_SO)
install-run: $(libcmt_SO)
mkdir -p $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib
cp -f $(libcmt_SO) $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib
$(TARGET_STRIP) -S -x $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib/libcmt.so

install: $(libcmt_LIB) build/ffi.h
mkdir -p $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib
cp -f $(libcmt_LIB) $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib
$(TARGET_STRIP) -S $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib/libcmt.a
mkdir -p $(TARGET_DESTDIR)$(TARGET_PREFIX)/include/libcmt/
cp -f include/libcmt/*.h $(TARGET_DESTDIR)$(TARGET_PREFIX)/include/libcmt/
cp -f build/ffi.h $(TARGET_DESTDIR)$(TARGET_PREFIX)/include/libcmt/
Expand Down
Loading
Loading