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

[next] Pass bootloader information in the dtb using a generic namespace #335

Open
jenneron opened this issue Mar 12, 2024 · 8 comments
Open

Comments

@jenneron
Copy link
Contributor

I suggest to attach to fdt something like:

bootloader,name = "lk2nd"
bootloader,type = "msm8916-secondary";
bootloader,version = "0.15.0";

Then this information can be read from /proc/device-tree by userspace.

Once we have something like this we can propose fwupd to read these values to identify the bootloader. If we get this functionality to fwupd we will be able to implement upgrades for lk2nd through fwupd.

Note that I suggest having some generic prefix like bootloader, instead of lk2nd,, so we can use this approach in other bootloaders, e.g. U-Boot + extlinux

@jenneron
Copy link
Contributor Author

If we get the whole idea going I could help you with pushing binaries to fwupd repo automatically using GitHub Actions

@jenneron
Copy link
Contributor Author

Also, I hope we can stop maintaining lk2nd packages in pmaports, but I'm not sure why these are there in the first place

@TravMurav
Copy link
Member

I've already implemented it in -next:

offset = fdt_path_offset(dtb, "/chosen");
if (offset < 0)
return 0;
ret = fdt_setprop_string(dtb, offset, "lk2nd,project", xstr(BOARD));
if (ret < 0)
return 0;
ret = fdt_setprop_string(dtb, offset, "lk2nd,version", LK2ND_VERSION);
if (ret < 0)
return 0;

@jenneron
Copy link
Contributor Author

@TravMurav nice, lol. But I would still like to point this:

Note that I suggest having some generic prefix like bootloader, instead of lk2nd,, so we can use this approach in other bootloaders, e.g. U-Boot + extlinux

We have been thinking about the same thing for tegra devices using u-boot, so it would be nice to have common fwupd solution

@TravMurav TravMurav changed the title expose information about bootloader to fdt for userspace [next] Pass bootloader information in the dtb using a generic namespace Mar 12, 2024
@TravMurav
Copy link
Member

TravMurav commented Mar 12, 2024

hm, interesting, if we can get wide-ish support for those properties, then it would be really nice, not sure if we have any upstream to give us guidance on that though, but bootloader, sounds sad as a vendor prefix, in which case I'd do

&{/chosen} {
    bootloader {
        name = "lk2nd";
        version = "18.0"
        lk2nd,project = "lk2nd-msm8916"
    };
};

or something like that, not exactly sure what would be a nice, scalable solution here

(...) i.e. I'm not sure if "subtype" would be generic enough to apply to everyone.

@jenneron
Copy link
Contributor Author

if you have this for lk2nd:

&{/chosen} {
    bootloader {
        name = "lk2nd";
        type = "lk2nd-msm8916";
        version = "18.0";
    };
};

we would have this for u-boot on tegra:

&{/chosen} {
    bootloader {
        name = "U-Boot (grate-drivers)"; // the name is U-Boot, but we use it in the fork, so let's specify fork here as well to distinguish them
        type = "asus-grouper"; // u-boot builds are per-device, so let's do it here
        version = "2024.01";
    };
};

(just to give you an idea what i want from U-Boot side)

@jenneron
Copy link
Contributor Author

it would be also nice to have stage = "primary" or stage = "secondary" under bootloader node

@jenneron
Copy link
Contributor Author

maybe something like this would be better for us:

&{/chosen} {
    bootloader {
        name = "U-Boot";
        type = "grate-drivers"
        device = "asus-grouper";
        version = "2024.01";
    };
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants