Skip to content

Commit

Permalink
Raspberry Pi foundation kernel variant (#7)
Browse files Browse the repository at this point in the history
* RPi5 kernel variant
* Hmm
* fail with the pkg name
---------

Signed-off-by: Skyler Mäntysaari <[email protected]>
  • Loading branch information
samip5 authored Dec 6, 2024
1 parent 34408d1 commit cafa540
Show file tree
Hide file tree
Showing 15 changed files with 4,170 additions and 10,995 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-08-08T07:05:38Z by kres dbf015a.
# Generated on 2024-12-05T23:59:54Z by kres 232fe63.

_out
.idea
61 changes: 61 additions & 0 deletions .kres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
kind: pkgfile.Build
spec:
targets:
- kernel
- kernel-rpi
---
kind: auto.CustomSteps
spec:
steps:
- name: kernel-olddefconfig
toplevel: true
- name: kernel-%
toplevel: true
- name: rpi-kernel-%
toplevel: true
---
kind: custom.Step
name: kernel-olddefconfig
spec:
makefile:
enabled: true
script:
- |
@$(MAKE) local-kernel-build TARGET_ARGS="--build-arg=KERNEL_TARGET=olddefconfig" PLATFORM=linux/amd64 DEST="kernel/build"
@$(MAKE) local-kernel-build TARGET_ARGS="--build-arg=KERNEL_TARGET=olddefconfig" PLATFORM=linux/arm64 DEST="kernel/build"
---
kind: custom.Step
name: kernel-rpi-bcm2712-defconfig
spec:
makefile:
enabled: true
script:
- |
@$(MAKE) local-rpi-kernel-build TARGET_ARGS="--build-arg=KERNEL_TARGET=bcm2712_defconfig" PLATFORM=linux/arm64 DEST="rpi-kernel/build"
---
kind: custom.Step
name: kernel-%
spec:
makefile:
enabled: true
script:
- |
for platform in $(shell echo $(PLATFORM) | tr "," " "); do \
arch=`basename $$platform` ; \
$(MAKE) docker-kernel-prepare PLATFORM=$$platform TARGET_ARGS="--tag=$(REGISTRY)/$(USERNAME)/kernel:$(TAG)-$$arch --load"; \
docker run --rm -it --entrypoint=/toolchain/bin/bash -e PATH=/toolchain/bin:/bin -w /src -v $$PWD/kernel/build/config-$$arch:/host/.hostconfig $(REGISTRY)/$(USERNAME)/kernel:$(TAG)-$$arch -c 'cp /host/.hostconfig .config && make $* && cp .config /host/.hostconfig'; \
done
---
kind: custom.Step
name: rpi-kernel-%
spec:
makefile:
enabled: true
script:
- |
for platform in $(shell echo $(PLATFORM) | tr "," " "); do \
arch=`basename $$platform` ; \
$(MAKE) docker-rpi-kernel-prepare PLATFORM=$$platform TARGET_ARGS="--tag=$(REGISTRY)/$(USERNAME)/kernel-rpi:$(TAG)-$$arch --load"; \
docker run --rm -it --entrypoint=/toolchain/bin/bash -e PATH=/toolchain/bin:/bin -w /src -v $$PWD/rpi-kernel/build/config-$$arch:/host/.hostconfig $(REGISTRY)/$(USERNAME)/kernel-rpi:$(TAG)-$$arch -c 'cp /host/.hostconfig .config && make $* && cp .config /host/.hostconfig'; \
done
52 changes: 34 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-08-08T07:05:38Z by kres dbf015a.
# Generated on 2024-12-06T00:58:57Z by kres 232fe63.

# common variables

Expand Down Expand Up @@ -36,22 +36,18 @@ PLATFORM ?= linux/amd64,linux/arm64
PROGRESS ?= auto
PUSH ?= false
CI_ARGS ?=
BUILDKIT_MULTI_PLATFORM ?= 0
COMMON_ARGS = --file=Pkgfile
COMMON_ARGS += --provenance=false
COMMON_ARGS += --progress=$(PROGRESS)
COMMON_ARGS += --platform=$(PLATFORM)
COMMON_ARGS += --build-arg=SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH)
COMMON_ARGS += --build-arg=PKGS_PREFIX="$(PKGS_PREFIX)"
COMMON_ARGS += --build-arg=PKGS="$(PKGS)"

# extra variables

PKGS_PREFIX ?= ghcr.io/siderolabs
PKGS ?= v1.7.0
COMMON_ARGS += --build-arg=BUILDKIT_MULTI_PLATFORM=$(BUILDKIT_MULTI_PLATFORM)

# targets defines all the available targets

TARGETS = kernel
TARGETS += kernel-rpi

# help menu

Expand Down Expand Up @@ -117,6 +113,15 @@ target-%: ## Builds the specified target defined in the Pkgfile. The build resu

local-%: ## Builds the specified target defined in the Pkgfile using the local output type. The build result will be output to the specified local destination.
@$(MAKE) target-$* TARGET_ARGS="--output=type=local,dest=$(DEST) $(TARGET_ARGS)"
@PLATFORM=$(PLATFORM) DEST=$(DEST) bash -c '\
for platform in $$(tr "," "\n" <<< "$$PLATFORM"); do \
echo $$platform; \
directory="$${platform//\//_}"; \
if [[ -d "$$DEST/$$directory" ]]; then \
mv "$$DEST/$$directory/"* $$DEST; \
rmdir "$$DEST/$$directory/"; \
fi; \
done'

docker-%: ## Builds the specified target defined in the Pkgfile using the docker output type. The build result will be loaded into Docker.
@$(MAKE) target-$* TARGET_ARGS="$(TARGET_ARGS)"
Expand All @@ -137,6 +142,27 @@ $(TARGETS):
deps.png: ## Generates a dependency graph of the Pkgfile.
@$(BLDR) graph | dot -Tpng -o deps.png

kernel-olddefconfig:
@$(MAKE) local-kernel-build TARGET_ARGS="--build-arg=KERNEL_TARGET=olddefconfig" PLATFORM=linux/amd64 DEST="kernel/build"
@$(MAKE) local-kernel-build TARGET_ARGS="--build-arg=KERNEL_TARGET=olddefconfig" PLATFORM=linux/arm64 DEST="kernel/build"

rpi-kernel-bcm2712-config:
@$(MAKE) local-rpi-kernel-build TARGET_ARGS="--build-arg=KERNEL_TARGET=bcm2712_defconfig" PLATFORM=linux/arm64 DEST="rpi-kernel/build"

kernel-%:
for platform in $(shell echo $(PLATFORM) | tr "," " "); do \
arch=`basename $$platform` ; \
$(MAKE) docker-kernel-prepare PLATFORM=$$platform TARGET_ARGS="--tag=$(REGISTRY)/$(USERNAME)/kernel:$(TAG)-$$arch --load"; \
docker run --rm -it --entrypoint=/toolchain/bin/bash -e PATH=/toolchain/bin:/bin -w /src -v $$PWD/kernel/build/config-$$arch:/host/.hostconfig $(REGISTRY)/$(USERNAME)/kernel:$(TAG)-$$arch -c 'cp /host/.hostconfig .config && make $* && cp .config /host/.hostconfig'; \
done

rpi-kernel-%:
for platform in $(shell echo $(PLATFORM) | tr "," " "); do \
arch=`basename $$platform` ; \
$(MAKE) docker-rpi-kernel-prepare PLATFORM=$$platform TARGET_ARGS="--tag=$(REGISTRY)/$(USERNAME)/kernel-rpi:$(TAG)-$$arch --load"; \
docker run --rm -it --entrypoint=/toolchain/bin/bash -e PATH=/toolchain/bin:/bin -w /src -v $$PWD/rpi-kernel/build/config-$$arch:/host/.hostconfig $(REGISTRY)/$(USERNAME)/kernel-rpi:$(TAG)-$$arch -c 'cp /host/.hostconfig .config && make $* && cp .config /host/.hostconfig'; \
done

.PHONY: rekres
rekres:
@docker pull $(KRES_IMAGE)
Expand All @@ -156,13 +182,3 @@ conformance:
@docker pull $(CONFORMANCE_IMAGE)
@docker run --rm -it -v $(PWD):/src -w /src $(CONFORMANCE_IMAGE) enforce

kernel-olddefconfig:
@$(MAKE) local-kernel-build TARGET_ARGS="--build-arg=KERNEL_TARGET=olddefconfig" PLATFORM=linux/amd64 DEST="kernel/build"
@$(MAKE) local-kernel-build TARGET_ARGS="--build-arg=KERNEL_TARGET=olddefconfig" PLATFORM=linux/arm64 DEST="kernel/build"

kernel-%:
for platform in $(shell echo $(PLATFORM) | tr "," " "); do \
arch=`basename $$platform` ; \
$(MAKE) docker-kernel-prepare PLATFORM=$$platform TARGET_ARGS="--tag=$(REGISTRY)/$(USERNAME)/kernel:$(TAG)-$$arch --load"; \
docker run --rm -it --entrypoint=/toolchain/bin/bash -e PATH=/toolchain/bin:/bin -w /src -v $$PWD/artifacts/kernel/build/config-$$arch:/host/.hostconfig $(REGISTRY)/$(USERNAME)/kernel:$(TAG)-$$arch -c 'cp /host/.hostconfig .config && make $* && cp .config /host/.hostconfig'; \
done
6 changes: 5 additions & 1 deletion Pkgfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ format: v1alpha2

vars:
# renovate: datasource=docker depName=ghcr.io/siderolabs/tools
TOOLS_IMAGE: ghcr.io/siderolabs/tools:v1.8.0-2-g7719230
TOOLS_IMAGE: ghcr.io/siderolabs/tools:v1.10.0-alpha.0

linux_rpi_ref: 545eb1a62b733857dd4556dfd67e6c81d73fc0e4
linux_rpi_sha256: 917b0aeb157b61417eae8b506f1f989ea511a9db4f16e38ecda3dfd2e81fe5c8
linux_rpi_sha512: c667cd74c12cb15d9e9ab763833aa7d225120cee880a3ed73ec511c8f7cff65025ccd32a9b8df14397e7aa6eefd7a62308466ae57276de05ce3f2de0ddf91619

# renovate: datasource=git-tags extractVersion=^v(?<version>.*)$ depName=git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
linux_version: 6.10.12
Expand Down
2 changes: 1 addition & 1 deletion artifacts/kernel/build/certs/x509.genkey
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ string_mask = utf8only
x509_extensions = myexts

[ req_distinguished_name ]
O = Sidero Labs, Inc.
O = Sky M Tmi
CN = Build time throw-away kernel key
#emailAddress = [email protected]

Expand Down
14 changes: 4 additions & 10 deletions artifacts/kernel/prepare/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,14 @@ steps:
&& ln -sf /toolchain/bin/true /bin/true \
&& ln -sf /toolchain/bin/false /bin/false \
&& ln -sf /toolchain/bin/pwd /bin/pwd
# Ensure that `make menuconfig` works.
ln -s /toolchain/bin/awk /usr/bin/awk
mkdir -p /usr/lib/pkgconfig
ln -s /toolchain/include /usr/include
for lib in ncurses form panel menu ; do
rm -vf /lib/lib${lib}.so
echo "INPUT(-l${lib}w)" > /lib/lib${lib}.so
ln -sfv ${lib}w.pc /lib/pkgconfig/${lib}.pc
done
make mrproper
install:
- |
mkdir -p /src
Expand Down
3 changes: 3 additions & 0 deletions artifacts/rpi-kernel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# RPI Kernel aka Foundation's variant

This is required for RPi5 support
17 changes: 17 additions & 0 deletions artifacts/rpi-kernel/build/certs/x509.genkey
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[ req ]
default_bits = 4096
distinguished_name = req_distinguished_name
prompt = no
string_mask = utf8only
x509_extensions = myexts

[ req_distinguished_name ]
O = Sky M Tmi
CN = Build time throw-away kernel key
#emailAddress = [email protected]

[ myexts ]
basicConstraints=critical,CA:FALSE
keyUsage=digitalSignature
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid
Loading

0 comments on commit cafa540

Please sign in to comment.