neilbrown / gnubee-tools

Tools for building gnubee firmware - and maybe more.
Other
31 stars 14 forks source link

introduce support for appending DTB to vmlinux.bin for Linux 6.2 #35

Closed arinc9 closed 1 year ago

arinc9 commented 1 year ago

For Linux 6.2, instead of relying on a non-upstream patch which makes the kernel include the DTB built-in, append the DTB file, and create a U-Boot bootable image ourselves. Change the script accordingly to achieve this.

This will become effective once kernel configs for 6.2 is added.

And utilise all threads available on the host to achieve shorter compilation time.

arinc9 commented 1 year ago

@paraka beware!

arinc9 commented 1 year ago

v2: Change mkinitramfs and gbmake scripts further to properly implement this feature.

arinc9 commented 1 year ago

v3: Get rid of the swp file nano editor created.

paraka commented 1 year ago

Thanks for doing this. I also do think that if we can live without an extra patch is better :-). I am a bit busy now to test, @arinc9 but I definitely will do when I have time ASAP.

arinc9 commented 1 year ago

@paraka, I've tested it on GB-PC2. It would be great if you can test gbpc1 and gbpc1u options on your GB-PC1 when you've got time.

arinc9 commented 1 year ago

@neilbrown needs to remove https://github.com/neilbrown/linux/commit/d020c3e05d9be001c2dd6775518a16d1ed8ff576 and modify the makefile change (also don't modify the Kconfig file) on https://github.com/neilbrown/linux/commit/2a0a791d81839b757f325a370eda78ca46900436 for gbpc1u to work.

neilbrown commented 1 year ago

Thanks a lot for this! I knew something like this would be needed but I didn't really know what form it would take. You've provided a great start.

I think I would like to aim this for 6.2 and later rather than making any changes to building 6.1. There would be just two config files for 6.2 - standard and a reduced one for "u-boot hacking" (which one day I want to make use of...). Building any kernel would always create both a PC1 and and PC2 version. The alternate build approach would be triggered by seeing if CONFIG_BUILTIN_DTB was set in the .config file.

Both firmwares would be copied to /srv/tftp with different names.. People who want tftp boot can either put a symlink there, or put different file names in the u-boot environment on their different gnubees.

Creating a reduced initramfs could be triggered by putting a special "CONFIG_DEFAULT_HOSTNAME=" in the kernconfig file.

Does that seem reasonable?

arinc9 commented 1 year ago

It makes sense, as long as you think the end product is worth the amount of time spent on it.

I guess you'd have to remove the "gbpcX-X" parameter from gbmake to build images for all GB-PCs. A lot of things are tied to that string, like which config to use, whether to use builtin DTB, whether to run gnubee_extern(), changing the value of add_optional, so the implementation may be challenging. I'd like to say I've got no interest to work on this.

Let me adjust my checks to look for 6.2 so it only becomes effective after you add kernel configs for 6.2. You can work on your plans on top of it.

arinc9 commented 1 year ago

Done.

arinc9 commented 1 year ago

I don't want to pour more time on this as neil seems to want to make fundamental changes to the way the tool works. What I'll do further will very likely become obsolete in the end. I'd like to leave this PR as is for neil to change it as they please when applying it. If you'd like to provide a diff for your suggestions above, I can amend the patch on top of it.

vincele commented 1 year ago

Yeah, I've seen (after doing this review) that some parts of it have already made their way in...

neilbrown commented 1 year ago

I merged a modified version of this patch. Net result is that I can now build a working firmware image using a pure mainline kernel (tested 6.1.11). That is awesome.

Thanks a lot.