From 882ce4a8f43c4e7a092fc0b9105b4a10298a951d Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 31 Mar 2019 15:13:18 +0200 Subject: [PATCH] Cleanup handling of linux packages and modules - All linux packages generate "linux" and "linux-modules" - Preference mechanism is used to select the right source package - Rootfs depends on "linux-modules" to install the selected kernels modules into the squashfs image - The release pacakge depends on "linux" to install the appropriate kernel to the boot partition Signed-off-by: David Oberhollenzer --- layer/bsp-alix/ROOTFS | 2 +- layer/bsp-alix/TOOLCHAIN | 1 + layer/bsp-qemu64/ROOTFS | 2 +- layer/bsp-qemu64/TOOLCHAIN | 1 + layer/bsp-rpi3/ROOTFS | 2 +- layer/bsp-rpi3/TOOLCHAIN | 1 + pkg/linux-lts/build | 19 ++++++++++--------- pkg/linux-lts/linux-lts.desc | 0 pkg/linux-rpi3/build | 1 + pkg/linux-rpi3/linux-rpi3.desc | 0 pkg/release-alix/build | 2 +- pkg/release-qemu/build | 2 +- pkg/release-rpi3/build | 2 +- pkg/rootfs/build | 7 ------- pkg/rootfs/rootfs.files | 1 - 15 files changed, 20 insertions(+), 23 deletions(-) delete mode 100644 pkg/linux-lts/linux-lts.desc delete mode 100644 pkg/linux-rpi3/linux-rpi3.desc diff --git a/layer/bsp-alix/ROOTFS b/layer/bsp-alix/ROOTFS index b70b58b..c2a969a 100644 --- a/layer/bsp-alix/ROOTFS +++ b/layer/bsp-alix/ROOTFS @@ -1,4 +1,4 @@ kmod btrfs-progs dosfstools -linux-lts +linux-modules diff --git a/layer/bsp-alix/TOOLCHAIN b/layer/bsp-alix/TOOLCHAIN index c90c0e6..f79bf25 100644 --- a/layer/bsp-alix/TOOLCHAIN +++ b/layer/bsp-alix/TOOLCHAIN @@ -7,6 +7,7 @@ GCC_EXTRACFG="--disable-libmpx --disable-cet" BINUTILS_EXTRACFG="--disable-cet" PREFERED_PROVIDER[linux]="linux-lts" +PREFERED_PROVIDER[linux-modules]="linux-lts" PREFERED_PROVIDER[release]="release-alix" LINUX_TGT="bzImage modules" diff --git a/layer/bsp-qemu64/ROOTFS b/layer/bsp-qemu64/ROOTFS index cf239ed..6558e11 100644 --- a/layer/bsp-qemu64/ROOTFS +++ b/layer/bsp-qemu64/ROOTFS @@ -1 +1 @@ -linux-lts +linux-modules diff --git a/layer/bsp-qemu64/TOOLCHAIN b/layer/bsp-qemu64/TOOLCHAIN index 5b27c95..66f4fe5 100644 --- a/layer/bsp-qemu64/TOOLCHAIN +++ b/layer/bsp-qemu64/TOOLCHAIN @@ -7,6 +7,7 @@ GCC_EXTRACFG="--enable-libmpx" BINUTILS_EXTRACFG="" PREFERED_PROVIDER[linux]="linux-lts" +PREFERED_PROVIDER[linux-modules]="linux-lts" PREFERED_PROVIDER[release]="release-qemu" LINUX_TGT="bzImage" diff --git a/layer/bsp-rpi3/ROOTFS b/layer/bsp-rpi3/ROOTFS index cce83ff..318fef9 100644 --- a/layer/bsp-rpi3/ROOTFS +++ b/layer/bsp-rpi3/ROOTFS @@ -1,7 +1,7 @@ kmod btrfs-progs dosfstools -linux-rpi3 +linux-modules firmware-rpi3 linux-firmware-rpi3 kbd diff --git a/layer/bsp-rpi3/TOOLCHAIN b/layer/bsp-rpi3/TOOLCHAIN index d739960..a288df4 100644 --- a/layer/bsp-rpi3/TOOLCHAIN +++ b/layer/bsp-rpi3/TOOLCHAIN @@ -7,6 +7,7 @@ GCC_EXTRACFG="--with-float=hard --with-fpu=neon-vfpv3" BINUTILS_EXTRACFG="" PREFERED_PROVIDER[linux]="linux-rpi3" +PREFERED_PROVIDER[linux-modules]="linux-rpi3" PREFERED_PROVIDER[release]="release-rpi3" LINUX_TGT="zImage dtbs modules" diff --git a/pkg/linux-lts/build b/pkg/linux-lts/build index 0b5f6bf..20e6118 100755 --- a/pkg/linux-lts/build +++ b/pkg/linux-lts/build @@ -8,6 +8,7 @@ TARBALL="linux-$VERSION.tar.xz" URL="https://www.kernel.org/pub/linux/kernel/v$MAJOR.x" SHA256SUM="a326d1154324aee3dd9a25ac44bc4ce7242ded097d4ca2e4c131e6f32918e7d9" DEPENDS="initrd" +SUBPKG="linux linux-modules" get_linux_cpu() { case "$TARGET" in @@ -58,28 +59,28 @@ deploy() { local target mkdir -p "$PKGDEPLOYDIR/boot" "$PKGDEPLOYDIR/lib/modules" + touch "$PKGDEPLOYDIR/linux.desc" "$PKGDEPLOYDIR/linux.files" + touch "$PKGDEPLOYDIR/linux-modules.desc" + touch "$PKGDEPLOYDIR/linux-modules.files" for target in $LINUX_TGT; do case $target in *Image) - cp "arch/$LINUX_CPU/boot/$target" "$PKGDEPLOYDIR/boot/vmlinuz" - echo "dir boot 0755 0 0" >> "$PKGDEPLOYDIR/$PKGNAME.files" - echo "file boot/vmlinuz 0755 0 0" >> "$PKGDEPLOYDIR/$PKGNAME.files" + cp "arch/$LINUX_CPU/boot/$target" "$PKGDEPLOYDIR/vmlinuz" + echo "file vmlinuz 0755 0 0" > "$PKGDEPLOYDIR/linux.files" ;; modules) export KBUILD_OUTPUT="$PKGBUILDDIR" make -C "$SOURCE" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" INSTALL_MOD_PATH="$PKGDEPLOYDIR" modules_install - echo "dir lib 0755 0 0" >> "$PKGDEPLOYDIR/$PKGNAME.files" - echo "dir lib/modules 0755 0 0" >> "$PKGDEPLOYDIR/$PKGNAME.files" + echo "dir lib 0755 0 0" > "$PKGDEPLOYDIR/linux-modules.files" - pkg_scan_dir "$PKGDEPLOYDIR/lib" |\ - sed "s#$PKGDEPLOYDIR/##g" >> "$PKGDEPLOYDIR/$PKGNAME.files" + pkg_scan_dir "$PKGDEPLOYDIR/lib" | \ + sed "s#$PKGDEPLOYDIR/##g" \ + >> "$PKGDEPLOYDIR/linux-modules.files" ;; esac done - - cp $SCRIPTDIR/pkg/$PKGNAME/*.desc "$PKGDEPLOYDIR" } check_update() { diff --git a/pkg/linux-lts/linux-lts.desc b/pkg/linux-lts/linux-lts.desc deleted file mode 100644 index e69de29..0000000 diff --git a/pkg/linux-rpi3/build b/pkg/linux-rpi3/build index 3802781..890f143 100755 --- a/pkg/linux-rpi3/build +++ b/pkg/linux-rpi3/build @@ -7,6 +7,7 @@ TARBALL="raspberrypi-kernel_${VERSION}.tar.gz" URL="https://github.com/raspberrypi/linux/archive" SHA256SUM="57ec23478db884eafe8fefd0bc1dbf557e93eda36fda1fe6a1db26e4b3f6fd12" DEPENDS="initrd" +SUBPKG="linux linux-modules" check_update() { local version=$(echo $VERSION | sed 's/-/./g') diff --git a/pkg/linux-rpi3/linux-rpi3.desc b/pkg/linux-rpi3/linux-rpi3.desc deleted file mode 100644 index e69de29..0000000 diff --git a/pkg/release-alix/build b/pkg/release-alix/build index a4287c0..905ed1a 100755 --- a/pkg/release-alix/build +++ b/pkg/release-alix/build @@ -1,4 +1,4 @@ -DEPENDS="rootfs" +DEPENDS="rootfs linux" SUBPKG="release" build() { diff --git a/pkg/release-qemu/build b/pkg/release-qemu/build index 35abd1e..a6936dd 100755 --- a/pkg/release-qemu/build +++ b/pkg/release-qemu/build @@ -1,4 +1,4 @@ -DEPENDS="rootfs" +DEPENDS="rootfs linux" SUBPKG="release" build() { diff --git a/pkg/release-rpi3/build b/pkg/release-rpi3/build index 8e09206..d2bd6e2 100755 --- a/pkg/release-rpi3/build +++ b/pkg/release-rpi3/build @@ -1,4 +1,4 @@ -DEPENDS="rootfs boot-rpi3" +DEPENDS="rootfs boot-rpi3 linux" SUBPKG="release" build() { diff --git a/pkg/rootfs/build b/pkg/rootfs/build index 2db6829..49d6e1f 100755 --- a/pkg/rootfs/build +++ b/pkg/rootfs/build @@ -27,13 +27,6 @@ _EOF sed -i 's#etc/#cfg/preserve/etc/#g' "$PKGDEPLOYDIR/pseudo" sed -i 's#var/lib/#cfg/preserve/var_lib/#g' "$PKGDEPLOYDIR/pseudo" sed -i 's#usr/#cfg/preserve/usr/#g' "$PKGDEPLOYDIR/pseudo" - - # don't add stuff for the boot partition to the squashfs image - mv $TCDIR/$TARGET/boot/* "$PKGDEPLOYDIR" - - grep -v "^boot/" "$PKGDEPLOYDIR/pseudo" > "$PKGDEPLOYDIR/pseudo.temp" - mv "$PKGDEPLOYDIR/pseudo.temp" "$PKGDEPLOYDIR/pseudo" - echo "boot m 750 0 0" >> "$PKGDEPLOYDIR/pseudo" } deploy() { diff --git a/pkg/rootfs/rootfs.files b/pkg/rootfs/rootfs.files index d7b8cb8..cc66e05 100644 --- a/pkg/rootfs/rootfs.files +++ b/pkg/rootfs/rootfs.files @@ -1,2 +1 @@ file rootfs.img 0755 0 0 -file vmlinuz 0755 0 0