mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
add riscv64 kernels to kernel/Makefile and kernel/Dockerfile.*, riscv64 kernel config, bump alpine version for kernel builds
Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
parent
efb139697e
commit
b63c7eb131
@ -274,7 +274,7 @@ your local Docker setup.
|
||||
|
||||
The process of modifying the kernel configuration is as follows:
|
||||
|
||||
1. Create a `linuxkit/kconfig` container image: `make kconfig`. This is not pushed out.
|
||||
1. Create a `linuxkit/kconfig` container image: `make kconfig`. This is not pushed out. By default, this will be for your local architecture, but you can override it with `make kconfig ARCH=${ARCH}`, e.g. `make kconfig ARCH=arm64`. The image is tagged with the architecture, e.g. `linuxkit/kconfig:arm64`.
|
||||
1. Run a container based on `linuxkit/kconfig`.
|
||||
1. In the container, modify the config to suit your needs using normal kernel tools like `make defconfig` or `make menuconfig`.
|
||||
1. Save the config from the image.
|
||||
@ -287,7 +287,11 @@ so that `make menuconfig` and `make defconfig` work correctly.
|
||||
Run the container as follows:
|
||||
|
||||
```sh
|
||||
docker run --rm -ti -v $(pwd):/src linuxkit/kconfig
|
||||
docker run --rm -ti -v $(pwd):/src linuxkit/kconfig:aarch64
|
||||
# or
|
||||
docker run --rm -ti -v $(pwd):/src linuxkit/kconfig:x86_64
|
||||
# or
|
||||
docker run --rm -ti -v $(pwd):/src linuxkit/kconfig:riscv64
|
||||
```
|
||||
|
||||
This will give you a interactive shell where you can modify the kernel
|
||||
@ -321,6 +325,11 @@ make ARCH=arm64 defconfig
|
||||
make ARCH=arm64 oldconfig # or menuconfig
|
||||
```
|
||||
|
||||
It is important to note that sometimes the configuration can be subtly different
|
||||
when running `make defconfig` across architectures. Of note is that `make ARCH=riscv` on
|
||||
x86_64 or aarch64 comes out slightly differently than when run natively on riscv64.
|
||||
Feel free to try it cross, but do not be surprised if it generates outputs that are not the same.
|
||||
|
||||
Note that the generated file **must** be final. When you actually build the kernel,
|
||||
it will check that running `make defconfig` will have no changes. If there are changes,
|
||||
the build will fail.
|
||||
|
@ -1,3 +1,3 @@
|
||||
KERNEL_VERSION=6.6.13
|
||||
KERNEL_VERSION=6.6.71
|
||||
KERNEL_SERIES=6.6.x
|
||||
BUILD_IMAGE=linuxkit/alpine:146f540f25cd92ec8ff0c5b0c98342a9a95e479e
|
||||
BUILD_IMAGE=linuxkit/alpine:8c02670fd2e5c28d03fd39db0bddc1379b3af6b2
|
||||
|
File diff suppressed because it is too large
Load Diff
5038
kernel/6.6.x/config-riscv64
Normal file
5038
kernel/6.6.x/config-riscv64
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -115,6 +115,9 @@ RUN case $(uname -m) in \
|
||||
aarch64) \
|
||||
KERNEL_DEF_CONF=/linux/arch/arm64/configs/defconfig; \
|
||||
;; \
|
||||
riscv64) \
|
||||
KERNEL_DEF_CONF=/linux/arch/riscv/configs/defconfig; \
|
||||
;; \
|
||||
esac && \
|
||||
cp /src/${KERNEL_SERIES}/config-$(uname -m) ${KERNEL_DEF_CONF}; \
|
||||
if [ -n "${EXTRA}" ] && [ -f "/src/${KERNEL_SERIES}-${EXTRA}/config-$(uname -m)" ]; then \
|
||||
@ -139,6 +142,9 @@ RUN make -j "$(getconf _NPROCESSORS_ONLN)" KCFLAGS="-fno-pie" && \
|
||||
aarch64) \
|
||||
cp arch/arm64/boot/Image.gz /out/kernel; \
|
||||
;; \
|
||||
riscv64) \
|
||||
cp arch/riscv64/boot/Image.gz /out/kernel; \
|
||||
;; \
|
||||
esac && \
|
||||
cp System.map /out && \
|
||||
([ -n "${DEBUG}" ] && cp vmlinux /out || true)
|
||||
|
@ -24,6 +24,7 @@ RUN apk update && apk upgrade -a && \
|
||||
iperf3 \
|
||||
libedit-dev \
|
||||
libtool \
|
||||
libxml2 \
|
||||
llvm \
|
||||
llvm-dev \
|
||||
llvm-static \
|
||||
|
@ -43,8 +43,9 @@ RUN set -e && \
|
||||
patch -t -F0 -N -u -p1 < "$patch"; \
|
||||
done; \
|
||||
fi && \
|
||||
[ ! -f /config-${SERIES}-x86_64 ] || mv /config-${SERIES}-x86_64 arch/x86/configs/x86_64_defconfig && \
|
||||
[ ! -f /config-${SERIES}-x86_64 ] || mv /config-${SERIES}-x86_64 arch/x86/configs/x86_64_defconfig ; \
|
||||
[ ! -f /config-${SERIES}-aarch64 ] || mv /config-${SERIES}-aarch64 arch/arm64/configs/defconfig ; \
|
||||
[ ! -f /config-${SERIES}-riscv64 ] || mv /config-${SERIES}-riscv64 arch/riscv64/configs/riscv64_defconfig ; \
|
||||
done
|
||||
|
||||
ENTRYPOINT ["/bin/sh"]
|
||||
|
@ -58,6 +58,9 @@ for VERSION in ${KERNEL_VERSIONS}; do
|
||||
elif [ ${TARGETARCH} = "arm64" ] ; then
|
||||
cp /config-${SERIES}-aarch64 .config
|
||||
ARCH=arm64 make oldconfig
|
||||
elif [ ${TARGETARCH} = "riscv64" ] ; then
|
||||
cp /config-${SERIES}-riscv64 .config
|
||||
ARCH=riscv64 make oldconfig
|
||||
fi
|
||||
done
|
||||
EOF
|
||||
|
@ -16,7 +16,7 @@ RM = rm -f
|
||||
# Name and Org on Hub
|
||||
ORG?=linuxkit
|
||||
IMAGE?=kernel
|
||||
IMAGE_BUILDER=linuxkit/alpine:146f540f25cd92ec8ff0c5b0c98342a9a95e479e
|
||||
IMAGE_BUILDER=linuxkit/alpine:8c02670fd2e5c28d03fd39db0bddc1379b3af6b2
|
||||
|
||||
# You can specify an extra options for the Makefile. This will:
|
||||
# - append a config$(EXTRA) to the kernel config for your kernel/arch
|
||||
@ -37,21 +37,23 @@ endif
|
||||
REPO_ROOT:=$(shell git rev-parse --show-toplevel)
|
||||
|
||||
# determine our architecture
|
||||
BUILDERARCH=
|
||||
ARCH?=$(shell uname -m)
|
||||
BUILDERARCH=$(ARCH)
|
||||
ifneq ($(ARCH),)
|
||||
ifeq ($(ARCH),$(filter $(ARCH),x86_64 amd64))
|
||||
override ARCH=x86_64
|
||||
BUILDERARCH=amd64
|
||||
override BUILDERARCH=amd64
|
||||
endif
|
||||
ifeq ($(ARCH),$(filter $(ARCH),aarch64 arm64))
|
||||
override ARCH=aarch64
|
||||
BUILDERARCH=arm64
|
||||
override BUILDERARCH=arm64
|
||||
endif
|
||||
ifeq ($(ARCH),riscv64)
|
||||
override BUILDERARCH=riscv64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(BUILDERARCH),)
|
||||
PLATFORMS=--platforms linux/$(BUILDERARCH)
|
||||
endif
|
||||
BUILD_PLATFORM=linux/$(BUILDERARCH)
|
||||
|
||||
HASHTAG=$(HASH)$(DIRTY)
|
||||
|
||||
@ -124,11 +126,11 @@ buildkerneldeps-%: Dockerfile Makefile $(wildcard patches-$(call series,$*)/*) $
|
||||
|
||||
buildplainkernel-%: buildkerneldeps-%
|
||||
$(eval KERNEL_SERIES=$(call series,$*))
|
||||
linuxkit pkg build . $(FORCE) $(PLATFORMS) --build-yml ./build-kernel.yml --tag "$*-{{.Hash}}" --build-arg-file $(KERNEL_SERIES)/build-args
|
||||
linuxkit pkg build . $(FORCE) --platforms $(BUILD_PLATFORM) --build-yml ./build-kernel.yml --tag "$*-{{.Hash}}" --build-arg-file $(KERNEL_SERIES)/build-args
|
||||
|
||||
builddebugkernel-%: buildkerneldeps-%
|
||||
$(eval KERNEL_SERIES=$(call series,$*))
|
||||
linuxkit pkg build . $(FORCE) $(PLATFORMS) --build-yml ./build-kernel.yml --tag "$*-dbg-{{.Hash}}" --build-arg-file $(KERNEL_SERIES)/build-args --build-arg-file build-args-debug
|
||||
linuxkit pkg build . $(FORCE) --platforms $(BUILD_PLATFORM) --build-yml ./build-kernel.yml --tag "$*-dbg-{{.Hash}}" --build-arg-file $(KERNEL_SERIES)/build-args --build-arg-file build-args-debug
|
||||
|
||||
push-%: notdirty build-% pushkernel-% tagbuilder-% pushtools-%;
|
||||
|
||||
@ -163,7 +165,7 @@ buildtool-%:
|
||||
$(eval TOOL=$(call toolname,$*))
|
||||
$(eval KERNEL_VERSION=$(call toolkernel,$*))
|
||||
$(eval KERNEL_SERIES=$(call series,$(KERNEL_VERSION)))
|
||||
linuxkit pkg build . $(FORCE) $(PLATFORMS) --build-yml ./build-$(TOOL).yml --tag "$(KERNEL_VERSION)-{{.Hash}}" --build-arg-file $(KERNEL_SERIES)/build-args
|
||||
linuxkit pkg build . $(FORCE) --platforms $(BUILD_PLATFORM) --build-yml ./build-$(TOOL).yml --tag "$(KERNEL_VERSION)-{{.Hash}}" --build-arg-file $(KERNEL_SERIES)/build-args
|
||||
|
||||
pushtools-%: $(addprefix pushtool-%$(RELEASESEP),$(TOOLS));
|
||||
|
||||
@ -206,34 +208,34 @@ update-kernel-semver-yaml-%:
|
||||
update-kernel-yamls: $(addprefix update-kernel-hash-yaml-,$(KERNELS)) update-kernel-semver-yaml-$(KERNEL_HIGHEST);
|
||||
|
||||
# Target for kernel config
|
||||
kconfig:
|
||||
ifeq (${KCONFIG_TAG},)
|
||||
docker build --no-cache -f Dockerfile.kconfig \
|
||||
--build-arg KERNEL_VERSIONS="$(KERNEL_VERSIONS)" \
|
||||
--build-arg BUILD_IMAGE=$(IMAGE_BUILDER) \
|
||||
-t linuxkit/kconfig .
|
||||
else
|
||||
docker build --no-cache -f Dockerfile.kconfig \
|
||||
--build-arg KERNEL_VERSIONS="$(KERNEL_VERSIONS)" \
|
||||
--build-arg BUILD_IMAGE=$(IMAGE_BUILDER) \
|
||||
-t linuxkit/kconfig:${KCONFIG_TAG} .
|
||||
KCONFIG_TAG_EXTENSION=
|
||||
ifneq (${KCONFIG_TAG},)
|
||||
KCONFIG_TAG_EXTENSION=-${KCONFIG_TAG}
|
||||
endif
|
||||
|
||||
kconfig:
|
||||
docker build --no-cache -f Dockerfile.kconfig \
|
||||
--build-arg KERNEL_VERSIONS="$(KERNEL_VERSIONS)" \
|
||||
--build-arg BUILD_IMAGE=$(IMAGE_BUILDER) \
|
||||
--platform $(BUILD_PLATFORM) \
|
||||
-t linuxkit/kconfig:$(ARCH)${KCONFIG_TAG_EXTENSION} .
|
||||
|
||||
kconfigx:
|
||||
ifeq (${KCONFIG_TAG},)
|
||||
docker buildx build --no-cache -f Dockerfile.kconfigx \
|
||||
--platform=$(PLATFORMS) \
|
||||
--platform $(BUILD_PLATFORM) \
|
||||
--output . \
|
||||
--build-arg KERNEL_VERSIONS="$(KERNEL_VERSIONS)" \
|
||||
--build-arg BUILD_IMAGE=$(IMAGE_BUILDER) \
|
||||
-t linuxkit/kconfigx .
|
||||
-t linuxkit/kconfigx:$(ARCH) .
|
||||
cp linux_arm64/config-${KERNEL_VERSIONS}-arm64 config-${KERNEL_SERIES}-aarch64
|
||||
cp linux_amd64/config-${KERNEL_VERSIONS}-amd64 config-${KERNEL_SERIES}-x86_64
|
||||
cp linux_amd64/config-${KERNEL_VERSIONS}-riscv64 config-${KERNEL_SERIES}-riscv64
|
||||
else
|
||||
docker buildx build --no-cache -f Dockerfile.kconfigx \
|
||||
--platform=$(PLATFORMS) --push \
|
||||
--platform $(BUILD_PLATFORM) --push \
|
||||
--output . \
|
||||
--build-arg KERNEL_VERSIONS="$(KERNEL_VERSIONS)" \
|
||||
--build-arg BUILD_IMAGE=$(IMAGE_BUILDER) \
|
||||
-t linuxkit/kconfigx:${KCONFIG_TAG} .
|
||||
-t linuxkit/kconfigx:$(ARCH)${KCONFIG_TAG_EXTENSION} .
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user