# # SPDX-License-Identifier: GPL-2.0 # # Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com # # This file is a part of the Armbian Build Framework # https://github.com/armbian/build/ # enable_extension "flash-kernel" export LINUXFAMILY=bcm2711 export ARCH=arm64 export UEFI_FS_LABEL="RPICFG" # Windows/Mac users will see this if they mount the SD card. Configurable, but should be uppercase always export SKIP_BOOTSPLASH="yes" # video is init-ed before us export FK__PUBLISHED_KERNEL_VERSION="raspi" # flash kernel (FK) configuration export FK__KERNEL_PACKAGES="" export CPUMIN=500000 export CPUMAX=2000000 export GOVERNOR=ondemand case "${BRANCH}" in ddk) export RASPI_DISTRO_KERNEL=yes # This will cause board to include distro's prebuilt kernel, not from source ;; current) export RASPI_DISTRO_KERNEL=no export KERNELSOURCE='https://github.com/raspberrypi/linux' export KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel. For mainline caching. export KERNELBRANCH="branch:rpi-5.15.y" export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}" export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}" ;; edge) export RASPI_DISTRO_KERNEL=no export KERNELSOURCE='https://github.com/raspberrypi/linux' export KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel. For mainline caching. export KERNELBRANCH="branch:rpi-6.1.y" export KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}" export LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}" ;; esac pre_initramfs_flash_kernel__write_raspi_cmdline() { cat <<- EOD > "${FIRMWARE_DIR}/cmdline.txt" root=LABEL=${ROOT_FS_LABEL} rootfstype=ext4 rootwait fixrtc cgroup_enable=memory cgroup_memory=1 console=tty1 logo.nologo loglevel=1 EOD } pre_flash_kernel__symlink_dtb_and_kernel() { if [[ "${RASPI_DISTRO_KERNEL}" != "yes" ]]; then # and firmware. display_alert "Configuring flash-kernel DB..." "bcm2711" "info" cat <<- EOD >> "${MOUNT}"/etc/flash-kernel/db # Armbian kernels don't have a 'flavour'. Ignore flavors for all rpi revisions. Machine: Raspberry Pi * Kernel-Flavors: any EOD fi } extension_prepare_config__prepare_rpi_flash_kernel() { display_alert "Preparing bcm2711" "${RELEASE}, distro kernel?: ${RASPI_DISTRO_KERNEL}" "info" export RASPI_DISTRO_KERNEL="${RASPI_DISTRO_KERNEL:-no}" # Include a distro-built kernel? export SERIALCON="${RASPI_SERIALCON:-tty1}" # HDMI etc, not serial. most people don't have UART on rpi local usable_releases="jammy|kinetic|lunar" if [[ "$RELEASE" =~ ^(${usable_releases})$ ]]; then export FK__EXTRA_PACKAGES="rpi-eeprom linux-firmware linux-firmware-raspi pi-bluetooth libraspberrypi-bin cloud-initramfs-growroot" if [[ "$RELEASE" =~ ^(jammy|kinetic)$ ]]; then # Add raspi-config for those releases that have it; it might be useful. export FK__EXTRA_PACKAGES="${FK__EXTRA_PACKAGES} raspi-config" fi if [[ "${RASPI_DISTRO_KERNEL}" == "yes" ]]; then # and firmware. unset KERNELSOURCE # Make sure Armbian will not try to compile from source. export FK__KERNEL_PACKAGES="${FK__KERNEL_PACKAGES} linux-tools-raspi linux-raspi linux-image-raspi " # Ubuntu Impish+ split the kernel modules, add the extra ones too. if [[ "$RELEASE" =~ ^(jammy|kinetic)$ ]]; then export FK__KERNEL_PACKAGES="${FK__KERNEL_PACKAGES} linux-modules-extra-raspi" fi fi else if [[ "${KERNEL_ONLY}" != "yes" ]]; then display_alert "Can't use release for ${BOARD}. Try: ${usable_releases}" "${RELEASE}" "err" exit 27 fi fi }