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

Add recipe for balena bootloader #1097

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
@@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not "virtual/bootloader"?

Copy link
Contributor Author

@mtoman mtoman Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used to pull balena bootloader into the image without using the specific package name:
https://github.com/balena-os/balena-raspberrypi/pull/1091/files#diff-abca8cd7f0af2e032dfdeec9e689532b73da44e8b689133f6d02617cec7fb5f9R79

But I am not sure whether it is particularly useful since the package name will be per-device-repo anyway. That is the only place where it is used. I think it is virtual/balena-bootloader because it was virtual/linux-kboot in the old dev branches and I just changed linux-kboot to balena-bootloader everywhere.

I have no strong opinion either way, do you think we should provide virtual/bootloader here and pull linux-balena-bootloader into the image?

Copy link
Contributor

@alexgg alexgg Feb 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mtoman I think it's cleaner to use virtual/bootloader as currently that will build u-boot. Not introducing a second virtual target simplifies things.
On other platforms where we might use u-boot as vendor bootloader and then the balena-bootloader we might need to use different virtual targets - so this might be a reason to also use separate targets here.

Just give it a thought and let me know what you prefer - I tend to prefer just using virtual/bootloader as it's either u-boot or balena bootloader in this case, but I can see both.

Loading