103 lines
4.3 KiB
Plaintext
103 lines
4.3 KiB
Plaintext
#
|
|
# 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"
|
|
declare -g LINUXFAMILY=bcm2711
|
|
declare -g ARCH=arm64
|
|
declare -g UEFI_FS_LABEL="RPICFG" # Windows/Mac users will see this if they mount the SD card. Configurable, but should be uppercase always
|
|
declare -g SKIP_BOOTSPLASH="yes" # video is init-ed before us
|
|
declare -g FK__PUBLISHED_KERNEL_VERSION="raspi" # flash kernel (FK) configuration
|
|
declare -g FK__KERNEL_PACKAGES=""
|
|
declare -g CPUMIN=500000
|
|
declare -g CPUMAX=2000000
|
|
declare -g GOVERNOR=ondemand
|
|
|
|
case "${BRANCH}" in
|
|
|
|
ddk)
|
|
declare -g RASPI_DISTRO_KERNEL=yes # This will cause board to include distro's prebuilt kernel, not from source
|
|
;;
|
|
|
|
legacy)
|
|
declare -g RASPI_DISTRO_KERNEL=no
|
|
declare -g KERNELSOURCE='https://github.com/raspberrypi/linux'
|
|
declare -g KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel. For mainline caching.
|
|
declare -g KERNELBRANCH="branch:rpi-5.15.y"
|
|
declare -g KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
|
|
declare -g LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
|
|
;;
|
|
|
|
current)
|
|
declare -g RASPI_DISTRO_KERNEL=no
|
|
declare -g KERNELSOURCE='https://github.com/raspberrypi/linux'
|
|
declare -g KERNEL_MAJOR_MINOR="6.1" # Major and minor versions of this kernel. For mainline caching.
|
|
declare -g KERNELBRANCH="branch:rpi-6.1.y"
|
|
declare -g KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
|
|
declare -g LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
|
|
;;
|
|
|
|
edge)
|
|
declare -g RASPI_DISTRO_KERNEL=no
|
|
declare -g KERNELSOURCE='https://github.com/raspberrypi/linux'
|
|
declare -g KERNEL_MAJOR_MINOR="6.5" # Major and minor versions of this kernel. For mainline caching.
|
|
declare -g KERNELBRANCH="branch:rpi-6.5.y"
|
|
declare -g KERNELPATCHDIR="${LINUXFAMILY}-${BRANCH}"
|
|
declare -g LINUXCONFIG="linux-${LINUXFAMILY}-${BRANCH}"
|
|
;;
|
|
esac
|
|
|
|
pre_initramfs_flash_kernel__write_raspi_cmdline() {
|
|
if [[ "${RPI_DEBUG_CONSOLE}" == "yes" ]]; then
|
|
cat <<- EOD > "${FIRMWARE_DIR}/cmdline.txt"
|
|
root=LABEL=${ROOT_FS_LABEL} rootfstype=ext4 rootwait fixrtc cgroup_enable=memory cgroup_memory=1 console=tty1 console=ttyAMA0 loglevel=7 splash=verbose
|
|
EOD
|
|
else
|
|
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 splash=verbose
|
|
EOD
|
|
fi
|
|
}
|
|
|
|
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"
|
|
declare -g RASPI_DISTRO_KERNEL="${RASPI_DISTRO_KERNEL:-no}" # Include a distro-built kernel?
|
|
declare -g SERIALCON="${RASPI_SERIALCON:-tty1}" # HDMI etc, not serial. most people don't have UART on rpi
|
|
|
|
local usable_releases="jammy|kinetic|lunar"
|
|
|
|
# if RELEASE is set, make sure it is one of the ones we support.
|
|
if [[ -n "${RELEASE}" ]]; then
|
|
if [[ "$RELEASE" =~ ^(${usable_releases})$ ]]; then
|
|
declare -g FK__EXTRA_PACKAGES="rpi-eeprom linux-firmware linux-firmware-raspi pi-bluetooth libraspberrypi-bin cloud-initramfs-growroot busybox"
|
|
FK__EXTRA_PACKAGES="${FK__EXTRA_PACKAGES} raspi-config" # Add raspi-config for those releases that have it; it might be useful.
|
|
|
|
if [[ "${RASPI_DISTRO_KERNEL}" == "yes" ]]; then # and firmware.
|
|
unset KERNELSOURCE # Make sure Armbian will not try to compile from source.
|
|
declare -g 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
|
|
declare -g FK__KERNEL_PACKAGES="${FK__KERNEL_PACKAGES} linux-modules-extra-raspi"
|
|
fi
|
|
fi
|
|
else
|
|
exit_with_target_not_supported_error "Can't use release '${RELEASE}' for ${BOARD}. Try: '${usable_releases}'" "'${RELEASE}' not supported"
|
|
fi
|
|
fi
|
|
}
|