Skip to content

Commit

Permalink
fix: migrate configs to the linux repository (mpolitzer)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmikhalevich committed Nov 29, 2023
1 parent a4c6e17 commit 789e8d8
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 1,825 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
- name: Retrieve environment variables
run: make env >> $GITHUB_ENV

- name: Copy default Cartesi Linux config
run: make cartesi-linux-config

- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ RUN tar xzf ${BUILD_BASE}/dep/opensbi-${OPENSBI_VERSION}.tar.gz \
--strip-components=1 --one-top-level=${BUILD_BASE}/work/opensbi && \
rm ${BUILD_BASE}/dep/opensbi-${OPENSBI_VERSION}.tar.gz

COPY cartesi-linux-config ${BUILD_BASE}/work/linux/.config

# build
# ------------------------------------------------------------------------------
ARG IMAGE_KERNEL_VERSION=0.0.0
Expand Down
40 changes: 19 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#

.PHONY: all build download push run pull share copy clean clean-config checksum
.PHONY: all build download push run pull share copy clean checksum

MAJOR := 0
MINOR := 18
Expand All @@ -27,11 +27,16 @@ UNAME:=$(shell uname)
TAG ?= devel
TOOLCHAIN_REPOSITORY ?= cartesi/toolchain
TOOLCHAIN_TAG ?= 0.15.0
KERNEL_VERSION ?= linux-6.5.9-ctsi-y
KERNEL_SRCPATH := dep/linux-${KERNEL_VERSION}.tar.gz
OPENSBI_VERSION ?= opensbi-1.3.1-ctsi-y
OPENSBI_SRCPATH := dep/opensbi-${OPENSBI_VERSION}.tar.gz
KERNEL_CONFIG ?= configs/default-linux-config

DEP_DIR := dep

KERNEL_VERSION ?= 6.5.9
KERNEL_BRANCH ?= linux-${KERNEL_VERSION}-ctsi-y
KERNEL_SRCPATH := $(DEP_DIR)/linux-${KERNEL_VERSION}.tar.gz

OPENSBI_VERSION ?= 1.3.1
OPENSBI_BRANCH ?= opensbi-${OPENSBI_VERSION}-ctsi-y
OPENSBI_SRCPATH := $(DEP_DIR)/opensbi-${OPENSBI_VERSION}.tar.gz

CONTAINER_BASE := /opt/cartesi/kernel

Expand Down Expand Up @@ -79,7 +84,7 @@ endif
.NOTPARALLEL: all
all: build copy

build: cartesi-linux-config download
build: download
docker build -t $(IMG) $(BUILD_ARGS) .

push:
Expand All @@ -103,9 +108,6 @@ run-as-root:
-v `pwd`:$(CONTAINER_BASE) \
$(IMG) $(CONTAINER_COMMAND)

config: CONTAINER_COMMAND := $(CONTAINER_BASE)/scripts/update-linux-config
config: cartesi-linux-config run-as-root

env:
@echo KERNEL_VERSION="$(KERNEL_VERSION)"
@echo KERNEL_TIMESTAMP="$(KERNEL_TIMESTAMP)"
Expand All @@ -122,16 +124,16 @@ copy:
docker cp $$ID:$(BASE)/kernel/artifacts/ . && \
docker rm -v $$ID

cartesi-linux-config:
cp $(KERNEL_CONFIG) ./cartesi-linux-config
$(DEP_DIR):
mkdir dep

$(KERNEL_SRCPATH):
wget -O $@ https://github.com/cartesi/linux/archive/refs/heads/$(KERNEL_VERSION).tar.gz
$(KERNEL_SRCPATH): | $(DEP_DIR)
wget -O $@ https://github.com/cartesi/linux/archive/refs/heads/$(KERNEL_BRANCH).tar.gz

clean-config:
rm -f ./cartesi-linux-config
$(OPENSBI_SRCPATH): | $(DEP_DIR)
wget -O $@ https://github.com/cartesi/opensbi/archive/refs/heads/$(OPENSBI_BRANCH).tar.gz

clean: clean-config
clean:
rm -f $(HEADERS) $(IMAGE) $(LINUX) $(SELFTEST)

depclean: clean
Expand All @@ -145,7 +147,3 @@ shasumfile: $(KERNEL_SRCPATH) $(OPENSBI_SRCPATH)
@shasum -a 256 $^ > $@

download: checksum

$(OPENSBI_SRCPATH): URL=https://github.com/cartesi/opensbi/archive/refs/heads/${OPENSBI_VERSION}.tar.gz
$(OPENSBI_SRCPATH): | dep
T=`mktemp` && wget "$(URL)" -O $$T && mv $$T $@ || rm $$T
7 changes: 5 additions & 2 deletions build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ KERNEL_VERSION ?= $(shell make -sC $(LINUX_DIR) kernelversion)
KERNEL_TIMESTAMP ?= $(shell date -Ru)
IMAGE_KERNEL_VERSION?= 0.0.0
HEADERS := artifacts/linux-headers-$(KERNEL_VERSION)-v$(IMAGE_KERNEL_VERSION).tar.xz
IMAGE := artifacts/linux-nobbl-$(KERNEL_VERSION)-v$(IMAGE_KERNEL_VERSION).bin
LINUX := artifacts/linux-$(KERNEL_VERSION)-v$(IMAGE_KERNEL_VERSION).bin
IMAGE := artifacts/linux-$(KERNEL_VERSION)-v$(IMAGE_KERNEL_VERSION).bin
LINUX := artifacts/linux-opensbi-$(KERNEL_VERSION)-v$(IMAGE_KERNEL_VERSION).bin
LINUX_ELF := artifacts/linux-$(KERNEL_VERSION)-v$(IMAGE_KERNEL_VERSION).elf
SELFTEST := artifacts/linux-selftest-$(KERNEL_VERSION)-v$(IMAGE_KERNEL_VERSION).ext2
CROSS_DEB_FILENAME := artifacts/linux-libc-dev-riscv64-cross-$(KERNEL_VERSION)-v$(IMAGE_KERNEL_VERSION).deb
Expand Down Expand Up @@ -49,6 +49,9 @@ $(LINUX_DIR)/vmlinux $(IMAGE) $(HEADERS) &: $(LINUX_DIR)/.config
cp work/linux/arch/riscv/boot/Image $(IMAGE)
cp $(LINUX_DIR)/vmlinux $(LINUX_ELF)

$(LINUX_DIR)/.config:
$(MAKE) -rC $(LINUX_DIR) $(LINUX_OPTS) cartesi_defconfig

cross-deb: # TARGET == riscv64
mkdir -p $(DESTDIR)/DEBIAN
cat tools/template/cross-control.template | sed 's|ARG_KERNEL_VERSION|$(KERNEL_VERSION)|g' > $(DESTDIR)/DEBIAN/control
Expand Down
Loading

0 comments on commit 789e8d8

Please sign in to comment.