diff --git a/bootstrap.d/13-kernel.sh b/bootstrap.d/13-kernel.sh index 83ce64f..8fa4ef9 100644 --- a/bootstrap.d/13-kernel.sh +++ b/bootstrap.d/13-kernel.sh @@ -416,14 +416,18 @@ else # BUILD_KERNEL=false # echo Install precompiled kernel... # echo error: not implemented if [ "$SET_ARCH" = 64 ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then - if [ "$KERNEL_ZSWAP" = true ] ; then - RPI3_64_KERNEL_URL=RPI3_64_BIS_KERNEL_URL + + # Use Sakakis modified kernel if ZSWAP is active + if [ "$KERNEL_ZSWAP" = true ] || ; then + RPI3_64_KERNEL_URL=RPI3_64_BIS_KERNEL_URL fi + # Create temporary directory for dl temp_dir=$(as_nobody mktemp -d) # Fetch kernel dl as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI3_64_KERNEL_URL" + #extract download tar -xJf "${temp_dir}"/kernel.tar.xz -C "${temp_dir}" @@ -434,11 +438,10 @@ else # BUILD_KERNEL=false # Remove temporary directory for kernel sources rm -fr "${temp_dir}" + # Set permissions of the kernel sources chown -R root:root "${R}/boot/firmware" chown -R root:root "${R}/lib/modules" - #Create cmdline.txt for 15-rpi-config.sh - touch "${BOOT_DIR}/cmdline.txt" fi # INstall Kernel from hypriot comptabile with all Raspberry PI @@ -448,26 +451,36 @@ else # BUILD_KERNEL=false # Fetch kernel as_nobody wget -O "${temp_dir}"/kernel.deb -c "$RPI_32_KERNEL_URL" - # Fetch kernel header - as_nobody wget -O "${temp_dir}"/kernel-header.deb -c "$RPI_32_KERNELHEADER_URL" - + # Copy downloaded U-Boot sources mv "${temp_dir}"/kernel.deb "${R}"/tmp/kernel.deb - mv "${temp_dir}"/kernel-header.deb "${R}"/tmp/kernel-header.deb # Set permissions chown -R root:root "${R}"/tmp/kernel.deb - chown -R root:root "${R}"/tmp/kernel-header.deb # Install kernel chroot_exec dpkg -i /tmp/kernel.deb - # Install kernel header - chroot_exec dpkg -i /tmp/kernel-header.deb + # move /boot to /boot/firmware to fit script env. + #mkdir "${BOOT_DIR}" + mkdir "${temp_dir}"/firmware + mv "${R}"/boot/* "${temp_dir}"/firmware/ + mv "${temp_dir}"/firmware "${R}"/boot/ + + #same for kernel headers + if [ "$KERNEL_HEADERS" = true ] ; then + # Fetch kernel header + as_nobody wget -O "${temp_dir}"/kernel-header.deb -c "$RPI_32_KERNELHEADER_URL" + mv "${temp_dir}"/kernel-header.deb "${R}"/tmp/kernel-header.deb + chown -R root:root "${R}"/tmp/kernel-header.deb + # Install kernel header + chroot_exec dpkg -i /tmp/kernel-header.deb + rm -f "${R}"/tmp/kernel-header.deb + fi + # Remove temporary directory and files rm -fr "${temp_dir}" rm -f "${R}"/tmp/kernel.deb - rm -f "${R}"/tmp/kernel-header.deb fi # Check if kernel installation was successful @@ -477,4 +490,4 @@ else # BUILD_KERNEL=false cleanup exit 1 fi -fi +fi diff --git a/bootstrap.d/15-rpi-config.sh b/bootstrap.d/15-rpi-config.sh index 4d40fd1..5e33831 100644 --- a/bootstrap.d/15-rpi-config.sh +++ b/bootstrap.d/15-rpi-config.sh @@ -64,6 +64,28 @@ if [ "$ENABLE_CRYPTFS" = true ] ; then fi fi +if [ "$ENABLE_PRINTK" = true ] ; then + install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf" +fi + +# Install udev rule for serial alias - serial0 = console serial1=bluetooth +install_readonly files/etc/99-com.rules "${LIB_DIR}/udev/rules.d/99-com.rules" + +# Remove IPv6 networking support +if [ "$ENABLE_IPV6" = false ] ; then + CMDLINE="${CMDLINE} ipv6.disable=1" +fi + +# Automatically assign predictable network interface names +if [ "$ENABLE_IFNAMES" = false ] ; then + CMDLINE="${CMDLINE} net.ifnames=0" +else + CMDLINE="${CMDLINE} net.ifnames=1" +fi + +# Install firmware config +install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt" + #locks cpu at max frequency if [ "$ENABLE_TURBO" = true ] ; then echo "force_turbo=1" >> "${BOOT_DIR}/config.txt" @@ -71,18 +93,8 @@ if [ "$ENABLE_TURBO" = true ] ; then echo "boot_delay=1" >> "${BOOT_DIR}/config.txt" fi -if [ "$ENABLE_PRINTK" = true ] ; then - install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf" -fi - -# Install udev rule for serial alias -install_readonly files/etc/99-com.rules "${LIB_DIR}/udev/rules.d/99-com.rules" - if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then - # RPI0,3,3P Use default ttyS0 (mini-UART)as serial interface - SET_SERIAL="ttyS0" - # Bluetooth enabled if [ "$ENABLE_BLUETOOTH" = true ] ; then # Create temporary directory for Bluetooth sources @@ -120,7 +132,6 @@ if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then # Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore UART0/ttyAMA0 over GPIOs 14 & 15. Slow Bluetooth and slow cpu. Use /dev/ttyS0 instead of /dev/ttyAMA0 if [ "$ENABLE_MINIUART_OVERLAY" = true ] ; then - SET_SERIAL="ttyAMA0" # set overlay to swap ttyAMA0 and ttyS0 echo "dtoverlay=pi3-miniuart-bt" >> "${BOOT_DIR}/config.txt" @@ -129,23 +140,16 @@ if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then if [ "$ENABLE_TURBO" = false ] ; then echo "core_freq=250" >> "${BOOT_DIR}/config.txt" fi - - # Activate services - chroot_exec systemctl enable pi-bluetooth.hciuart.service - #chroot_exec systemctl enable pi-bluetooth.bthelper@.service - else - chroot_exec systemctl enable pi-bluetooth.hciuart.service - #chroot_exec systemctl enable pi-bluetooth.bthelper@.service fi + + # Activate services + chroot_exec systemctl enable pi-bluetooth.hciuart.service + chroot_exec systemctl enable pi-bluetooth.bthelper@serial1.service else # if ENABLE_BLUETOOTH = false # set overlay to disable bluetooth echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt" fi # ENABLE_BLUETOOTH end - -else - # RPI1,1P,2 Use default ttyAMA0 (full UART) as serial interface - SET_SERIAL="ttyAMA0" fi # may need sudo systemctl disable hciuart @@ -155,11 +159,11 @@ if [ "$ENABLE_CONSOLE" = true ] ; then CMDLINE="${CMDLINE} console=serial0,115200" # Enable serial console systemd style - chroot_exec systemctl enable serial-getty@"$SET_SERIAL".service + chroot_exec systemctl enable serial-getty@serial0.service else echo "enable_uart=0" >> "${BOOT_DIR}/config.txt" # disable serial console systemd style - chroot_exec systemctl disable serial-getty@"$SET_SERIAL".service + #chroot_exec systemctl disable serial-getty@serial0.service fi # Remove cmdline.txt entry of starting zswap @@ -204,24 +208,9 @@ if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then cd "${WORKDIR}" || exit fi -# Remove IPv6 networking support -if [ "$ENABLE_IPV6" = false ] ; then - CMDLINE="${CMDLINE} ipv6.disable=1" -fi - -# Automatically assign predictable network interface names -if [ "$ENABLE_IFNAMES" = false ] ; then - CMDLINE="${CMDLINE} net.ifnames=0" -else - CMDLINE="${CMDLINE} net.ifnames=1" -fi - # Install firmware boot cmdline echo "${CMDLINE}" > "${BOOT_DIR}/cmdline.txt" -# Install firmware config -install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt" - # Setup minimal GPU memory allocation size: 16MB (no X) if [ "$ENABLE_MINGPU" = true ] ; then echo "gpu_mem=16" >> "${BOOT_DIR}/config.txt" diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 3c8a47e..dca5968 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -225,8 +225,6 @@ MISSING_PACKAGES="" # Packages installed for c/c++ build environment in chroot (keep empty) COMPILER_PACKAGES="" -set +x - #Check if apt-cacher-ng has port 3142 open and set APT_PROXY APT_CACHER_RUNNING=$(lsof -i :3142 | cut -d ' ' -f3 | uniq | sed '/^\s*$/d') if [ "${APT_CACHER_RUNNING}" = "apt-cacher-ng" ] ; then @@ -245,9 +243,9 @@ rm "$(pwd)/files/apt/sources.list" fi if [ "$ENABLE_NONFREE" = true ] ; then - netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --nonfree --outfile "$(pwd)/files/apt/sources.list" -d "$RLS" + netselect-apt --arch "$RELEASE_ARCH" -t 3 --sources --nonfree --outfile "$(pwd)/files/apt/sources.list" -d "$RLS" else - netselect-apt --arch "$RELEASE_ARCH" --tests 10 --sources --outfile "$(pwd)/files/apt/sources.list" -d "$RLS" + netselect-apt --arch "$RELEASE_ARCH" -t 3 --sources --outfile "$(pwd)/files/apt/sources.list" -d "$RLS" fi #sed and cut the result string so we can use it as APT_SERVER @@ -367,6 +365,8 @@ if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; then fi fi +set +x + # Add cmake to compile videocore sources if [ "$ENABLE_VIDEOCORE" = true ] ; then REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cmake"