Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to balena bootloader on raspberrypi4-64 #1091

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ CMDLINE += " ${@bb.utils.contains('DISTRO_FEATURES','osdev-image',"console=tty1
CMDLINE += " cgroup_enable=memory"
CMDLINE:remove = "root=/dev/mmcblk0p2"
CMDLINE_DEBUG = ""

# Necessary for balena bootloader to work
# These will not be passed to the actual kernel
CMDLINE:append:raspberrypi4-64 := " balena_stage2 nr_cpus=1"
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ BALENA_BOOT_PARTITION_FILES:rpi = " \
bootfiles:/ \
"

BALENA_BOOT_PARTITION_FILES:remove:raspberrypi4-64 = " \
u-boot.bin:/${SDIMG_KERNELIMAGE} \
boot.scr:/boot.scr \
"

BALENA_BOOT_PARTITION_FILES:append:raspberrypi4-64 = " \
balena-bootloader/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin:/${SDIMG_KERNELIMAGE} \
balena-bootloader/bootenv:/bootenv \
"

BALENA_BOOT_PARTITION_FILES:append:revpi-core-3 = " revpi-core-dt-blob-overlay.dtb:/dt-blob.bin"

BALENA_BOOT_PARTITION_FILES:append:revpi-connect = " revpi-connect-dt-blob-overlay.dtb:/dt-blob.bin"
Expand Down Expand Up @@ -63,6 +73,11 @@ python overlay_dtbs_handler () {
do_resin_boot_dirgen_and_deploy[prefuncs] += "overlay_dtbs_handler"

IMAGE_INSTALL:append:rpi = " u-boot"
IMAGE_INSTALL:remove:raspberrypi4-64 = " u-boot"
IMAGE_INSTALL:append:raspberrypi4-64 = " grub-editenv"

do_rootfs[depends] += "${@oe.utils.conditional('MACHINE','raspberrypi4-64',' virtual/balena-bootloader:do_deploy','',d)}"
do_image_balenaos_img[depends] += "${@oe.utils.conditional('MACHINE','raspberrypi4-64',' virtual/balena-bootloader:do_deploy','',d)}"

do_resin_boot_dirgen_and_deploy[depends] += "virtual/kernel:do_install"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
LINUX_VERSION ?= "6.1.64"
LINUX_RPI_BRANCH ?= "rpi-6.1.y"
LINUX_RPI_KMETA_BRANCH ?= "yocto-6.1"

SRCREV_machine = "dad5d57939cfae7af363e7c9862b59d33d96794b"
SRCREV_meta = "f845a7f37d7114230d6609e2bd630070f2f6cd9b"

KMETA = "kernel-meta"

SRC_URI = " \
git://github.com/raspberrypi/linux.git;name=machine;branch=${LINUX_RPI_BRANCH};protocol=https \
git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=${LINUX_RPI_KMETA_BRANCH};destsuffix=${KMETA} \
"
SRC_URI:remove = "file://initramfs-image-bundle.cfg"
SRC_URI:remove = "file://vc4graphics.cfg"

require recipes-kernel/linux/linux-raspberrypi.inc

inherit balena-bootloader

BALENA_DEFCONFIG_NAME = "${KBUILD_DEFCONFIG}"

BALENA_CONFIGS:append = " \
rpisense \
"

BALENA_CONFIGS[rpisense] = " \
CONFIG_MFD_RPISENSE_CORE=n \
CONFIG_FB_RPISENSE=n \
"

do_deploy:append () {
BOOTENV_FILE="${DEPLOYDIR}/${KERNEL_PACKAGE_NAME}/bootenv"
grub-editenv "${BOOTENV_FILE}" create
grub-editenv "${BOOTENV_FILE}" set "resin_root_part=A"
grub-editenv "${BOOTENV_FILE}" set "bootcount=0"
grub-editenv "${BOOTENV_FILE}" set "upgrade_available=0"
}

do_deploy[depends] += " grub-native:do_populate_sysroot"

KERNEL_DTC_FLAGS += "-@ -H epapr"

INITRAMFS_IMAGE = "balena-image-bootloader-initramfs"

KERNEL_PACKAGE_NAME = "balena-bootloader"

KERNEL_DEVICETREE = "${RPI_KERNEL_DEVICETREE}"

PROVIDES = "virtual/balena-bootloader"
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ FILESEXTRAPATHS:append := ":${THISDIR}/files"

HOSTAPP_HOOKS += " 99-resin-uboot 999-resin-boot-cleaner"
HOSTAPP_HOOKS:append:revpi-core-3 = " 9999-bootfiles"

HOSTAPP_HOOKS:remove:raspberrypi4-64 = "99-resin-uboot 999-resin-boot-cleaner"
HOSTAPP_HOOKS:append:raspberrypi4-64 = " 99-balena-bootloader"
Loading