From 9e5bb80b1061211597eaf84d59c8061ff2d4c694 2018-11-10 20:32:27 From: Unknown Date: 2018-11-10 20:32:27 Subject: [PATCH] Added support for precompiled kernel other than collabora --- diff --git a/bootstrap.d/11-apt.sh b/bootstrap.d/11-apt.sh index 3c9b2a0..0f03744 100644 --- a/bootstrap.d/11-apt.sh +++ b/bootstrap.d/11-apt.sh @@ -12,6 +12,7 @@ if [ -z "$APT_PROXY" ] ; then fi if [ "$BUILD_KERNEL" = false ] ; then + if [ RPI_MODEL = 2 ] ; then # Install APT pinning configuration for flash-kernel package install_readonly files/apt/flash-kernel "${ETC_DIR}/apt/preferences.d/flash-kernel" @@ -22,6 +23,11 @@ if [ "$BUILD_KERNEL" = false ] ; then # Upgrade collabora package index and install collabora keyring chroot_exec apt-get -qq -y update chroot_exec apt-get -qq -y --allow-unauthenticated install collabora-obs-archive-keyring + # if RPI_MODEL = [0] || [1] || [1P] + else + # insert apt configuration for precompiled kernel repository for RPI 0,1,1P + fi + else # BUILD_KERNEL=true # Install APT sources.list install_readonly files/apt/sources.list "${ETC_DIR}/apt/sources.list" diff --git a/bootstrap.d/13-kernel.sh b/bootstrap.d/13-kernel.sh index a3c2e0c..c34bc0e 100644 --- a/bootstrap.d/13-kernel.sh +++ b/bootstrap.d/13-kernel.sh @@ -233,21 +233,34 @@ if [ "$BUILD_KERNEL" = true ] ; then chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source" fi fi - -else # BUILD_KERNEL=false - # Kernel installation - chroot_exec apt-get -qq -y --no-install-recommends install linux-image-"${COLLABORA_KERNEL}" raspberrypi-bootloader-nokernel - - # Install flash-kernel last so it doesn't try (and fail) to detect the platform in the chroot - chroot_exec apt-get -qq -y install flash-kernel - - # Check if kernel installation was successful - VMLINUZ="$(ls -1 ${R}/boot/vmlinuz-* | sort | tail -n 1)" - if [ -z "$VMLINUZ" ] ; then - echo "error: kernel installation failed! (/boot/vmlinuz-* not found)" - cleanup - exit 1 +elif [ BUILD_KERNEL = false ] + # Collabora states this kernel is just for RPI 2 so better implement a check. + #From https://repositories.collabora.co.uk/debian/dists/jessie/rpi2/binary-armhf/Packages + #"The Linux kernel "${COLLABORA_KERNEL}" and modules for use on ARMv7 kernel for Raspberry pi 2 model B+" + # nested if to be easily extended for more precompiled kernels + if [ "$SET_ARCH" = 32 ] ; then + if [ RPI_MODEL = 2 ] ; then + # Kernel installation + chroot_exec apt-get -qq -y --no-install-recommends install linux-image-"${COLLABORA_KERNEL}" raspberrypi-bootloader-nokernel + + # Install flash-kernel last so it doesn't try (and fail) to detect the platform in the chroot + chroot_exec apt-get -qq -y install flash-kernel + + # Check if kernel installation was successful + VMLINUZ="$(ls -1 ${R}/boot/vmlinuz-* | sort | tail -n 1)" + if [ -z "$VMLINUZ" ] ; then + echo "error: kernel installation failed! (/boot/vmlinuz-* not found)" + cleanup + exit 1 + fi + # Copy vmlinuz kernel to the boot directory + install_readonly "${VMLINUZ}" "${BOOT_DIR}/${KERNEL_IMAGE}" + fi + if [ RPI_MODEL = 0 ] || [ RPI_MODEL = 1 ] || [ RPI_MODEL = 1P ] ; then + # insert precompiled Kernel here + fi + #if [ "$SET_ARCH" = 64 ] + else + # inset precompiled 64 bit kernel here fi - # Copy vmlinuz kernel to the boot directory - install_readonly "${VMLINUZ}" "${BOOT_DIR}/${KERNEL_IMAGE}" fi diff --git a/bootstrap.d/15-rpi-config.sh b/bootstrap.d/15-rpi-config.sh index 5018fcf..c3f475d 100644 --- a/bootstrap.d/15-rpi-config.sh +++ b/bootstrap.d/15-rpi-config.sh @@ -112,7 +112,7 @@ install_readonly files/modules/rpi2.conf "${R}/lib/modules-load.d/rpi2.conf" # Load hardware random module at boot if [ "$ENABLE_HWRANDOM" = true ] && [ "$BUILD_KERNEL" = false ] ; then - sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${R}/lib/modules-load.d/rpi2.conf" + sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${R}/lib/modules-load.d/rpi2.conf" fi # Load sound module at boot diff --git a/bootstrap.d/41-uboot.sh b/bootstrap.d/41-uboot.sh index a7f4709..f107440 100644 --- a/bootstrap.d/41-uboot.sh +++ b/bootstrap.d/41-uboot.sh @@ -58,9 +58,9 @@ if [ "$ENABLE_UBOOT" = true ] ; then sed -i '/.*initramfs.*/d' "${BOOT_DIR}/uboot.mkimage" if [ "$BUILD_KERNEL" = false ] ; then - # Remove dtbfile from U-Boot mkfile - sed -i '/.*dtbfile.*/d' "${BOOT_DIR}/uboot.mkimage" - printf "\nbootz \${kernel_addr_r}" >> "${BOOT_DIR}/uboot.mkimage" + # Remove dtbfile from U-Boot mkfile + sed -i '/.*dtbfile.*/d' "${BOOT_DIR}/uboot.mkimage" + printf "\nbootz \${kernel_addr_r}" >> "${BOOT_DIR}/uboot.mkimage" else printf "\nbootz \${kernel_addr_r} - \${fdt_addr_r}" >> "${BOOT_DIR}/uboot.mkimage" fi