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

Document os_prefix, overlay_prefix, upstream_kernel #1433

Merged
merged 3 commits into from
Mar 19, 2020

Conversation

pelwell
Copy link
Contributor

@pelwell pelwell commented Mar 13, 2020

Some much needed documentation for the newer loader features.

@JamesH65
Copy link
Contributor

LGTM. @lurch ?

@pelwell
Copy link
Contributor Author

pelwell commented Mar 16, 2020

Ping @lurch.


`os_prefix` is an optional setting that allows you to choose between multiple versions of the kernel and Device Tree files installed on the same card. Any value in `os_prefix` is prepended to (stuck in front of) the name of any operating system files loaded by the firmware, where "operating system files" is defined to mean kernels, initramfs, cmdline.txt, .dtbs and overlays. The prefix would commonly be a directory name, but it could also be part of the filename such as "test-". For this reason, directory prefixes must include the trailing `/` character.

In an attempt to reduce the chance of a non-bootable system, the firmware first tests the supplied prefix value for viability - unless the expected kernel and .dtb can be found at the new location/name, the prefix is ignored (set to ""). A special case of this viability test is applied to overlays, which will only be loaded from `${os_prefix}${overlay_prefix}` (where the default value of [`overlay_prefix`](#overlay_prefix) is "overlays/") if `${os_prefix}${overlay_prefix}README` exists, otherwise it ignores `os_prefix` and treats overlays as shared.
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it's worth somehow cross-linking this to https://github.com/raspberrypi/documentation/blob/master/configuration/config-txt/boot.md where the "expected kernel names" are described?

On a side-note, should https://github.com/raspberrypi/documentation/blob/master/configuration/boot_folder.md say something about kernel filenames?? @JamesH65

Copy link
Contributor

Choose a reason for hiding this comment

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

On a side-note, should https://github.com/raspberrypi/documentation/blob/master/configuration/boot_folder.md say something about kernel filenames?? @JamesH65

Yes, I'll do that today.

They are AIUI:
kernel.img -> Up to BCM2836? (Pi0, PI1, Pi2 with 2836)
kernel7.img -> 2837 (Pi2 with 2837, Pi3)
kernel7l.img -> 2711 (Pi4), standard 32bit kernel with LPAE
kernel8.img -> Beta 64bit kernel

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Bit confused about kernel.img and its use. Not sure that linked page is correct (IIRC, I wrote it...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll leave cross-linking to the experts.

Copy link
Contributor

Choose a reason for hiding this comment

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

@JamesH65 Do you think it's worth making the "expected kernel and .dtb" text in the bit above a link to https://github.com/raspberrypi/documentation/blob/master/configuration/boot_folder.md


To allow a common DTB to be used, if the upstream file isn't found the firmware will load the downstream variant instead and automatically apply the "upstream" overlay.
The firmware will also prefer upstream Linux names for DTBs (`bcm2837-rpi-3-b.dtb` instead of `bcm2710-rpi-3-b.dtb`, for example). If the upstream file isn't found the firmware will load the downstream variant instead and automatically apply the "upstream" overlay to make some adjustments. Note that this process happens _after_ the `os_prefix` has been finalised.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the "upstream overlay" have a specific filename that could be mentioned here, or is it more complex than that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, upstream.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not upstream.dtbo ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't confuse the name of the overlay with the name of the file.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's kinda what I was getting at - perhaps it should say:
and automatically apply the "upstream" overlay (upstream.dtbo) to make some adjustments.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see the point of emphasising the filename - overlays are referred to by name, not by filename. The overlay filename convention has changed before, but the names of the overlays didn't have to.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough - as somebody unfamiliar with DeviceTree, I had no clue what apply the "upstream" overlay was inferring. But I guess others are probably less clueless than me 😁

@lurch
Copy link
Contributor

lurch commented Mar 19, 2020

@pelwell This is a bit of a side-question, but with the talk in here about os_prefix and overlay_prefix, is there a way for the booted OS to tell what values these were set / forced to for the running kernel? (because I guess e.g. an OS might want to know which boot directory it should be placing an updated kernel into?)

@JamesH65
Copy link
Contributor

@pelwell This is a bit of a side-question, but with the talk in here about os_prefix and overlay_prefix, is there a way for the booted OS to tell what values these were set / forced to for the running kernel? (because I guess e.g. an OS might want to know which boot directory it should be placing an updated kernel into?)

Don't think it would do any harm, but not entirely convinced it's necessary, although did just put in that rather splendid table...

@lurch
Copy link
Contributor

lurch commented Mar 19, 2020

Assuming you quoted the wrong comment in your reply James? Yeah, I waited for your splendid table to get merged before making the link-suggestion on this PR 😉

@pelwell
Copy link
Contributor Author

pelwell commented Mar 19, 2020

vcgencmd get_config os_prefix etc.

@pelwell
Copy link
Contributor Author

pelwell commented Mar 19, 2020

Are these comments going to converge anytime soon?

@JamesH65
Copy link
Contributor

I'm inclined to merge now and fix any other problems later.

@JamesH65
Copy link
Contributor

No complaints so merging.

@JamesH65 JamesH65 merged commit c4a6ee2 into raspberrypi:master Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants