[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: making debs for u-boot kernels



On Tuesday 23 July 2019 09:12:21 Stefan Monnier wrote:

> > So what tools do I use to build an installable kernel deb for a
> > u-boot system?
>
> I'm not sure what you mean.

The u-boot protocol assumes some of the files you see here:
pi@picnc:~ $ ls -la /boot
total 35466
drwxr-xr-x  3 root root     2560 Dec 31  1969 .
drwxr-xr-x 22 root root     4096 Jun 24 13:51 ..
-rwxr-xr-x  1 root root    23315 Sep 19  2018 bcm2708-rpi-0-w.dtb
-rwxr-xr-x  1 root root    22812 Sep 19  2018 bcm2708-rpi-b.dtb
-rwxr-xr-x  1 root root    23071 Sep 19  2018 bcm2708-rpi-b-plus.dtb
-rwxr-xr-x  1 root root    22589 Sep 19  2018 bcm2708-rpi-cm.dtb
-rwxr-xr-x  1 root root    24115 Sep 19  2018 bcm2709-rpi-2-b.dtb
-rwxr-xr-x  1 root root    25311 Sep 19  2018 bcm2710-rpi-3-b.dtb
-rwxr-xr-x  1 root root    25914 Feb 18 05:10 bcm2710-rpi-3-b-plus.dtb
-rwxr-xr-x  1 root root    24087 Sep 19  2018 bcm2710-rpi-cm3.dtb
-rwxr-xr-x  1 root root    52296 Feb 18 05:10 bootcode.bin
-rwxr-xr-x  1 root root      187 Dec 31  1979 cmdline.txt
-rwxr-xr-x  1 root root     1590 Apr  8 05:56 config.txt
-rwxr-xr-x  1 root root    18693 Mar  9  2018 COPYING.linux
-rwxr-xr-x  1 root root     2622 Apr  1 10:03 fixup_cd.dat
-rwxr-xr-x  1 root root     6701 Apr  1 10:03 fixup.dat
-rwxr-xr-x  1 root root     9750 Apr  1 10:03 fixup_db.dat
-rwxr-xr-x  1 root root     9752 Apr  1 10:03 fixup_x.dat
-rwxr-xr-x  1 root root      145 Apr  8 06:43 issue.txt
-rwxr-xr-x  1 root root 13173096 Jun 23 18:59 kernel7.img
-rwxr-xr-x  1 root root 10637100 Jun 23 17:35 kernel.img
-rwxr-xr-x  1 root root     1494 Mar  9  2018 LICENCE.broadcom
-rwxr-xr-x  1 root root    18974 Apr  8 06:43 LICENSE.oracle
drwxr-xr-x  2 root root    13312 Apr  8 05:48 overlays
-rwxr-xr-x  1 root root     1844 Jun 23 16:08 
realtimepi-wpa-supplicant.txt
-rwxr-xr-x  1 root root   683460 Apr  1 10:03 start_cd.elf
-rwxr-xr-x  1 root root  4830756 Apr  1 10:03 start_db.elf
-rwxr-xr-x  1 root root  2873444 Apr  1 10:03 start.elf
-rwxr-xr-x  1 root root  3774980 Apr  1 10:03 start_x.elf
Are located at fixed offsets from the disks LSN0.  This is because the 
very limited, not even a bios, boot can find what it needs by lba 
addressing. So the /boot dir you see above is only for human eyes, but 
in fact bootcode.bin and the kernel images above are actually at fixed 
lba offsets.  So the installer has to get them, not by a directory 
entry, but at those fixed address's
Or at least thats what it says in the original u-boot docs that I have.
>
> My BananaPi here uses the stock Debian kernels without any trouble.
> Both the vmlinuz and the dtb files are read as-is by U-Boot.
> The only thing I need to do is to package the initrd using `mkimage`
> (found in `u-boot-tools`).
>
> See the /boot/GNUmakefile I use to help me do that, below

I have no such file as can be see above, in the /boot partition of the 
u-sd card.
>
>         Stefan
This is I presume named GNUMakefile and is called by

make -f GNUMakefile
?
>
> # Make it so that `make` checks the timestamp of symlinks as well.
> MAKEFLAGS += -L
>
> MACHINE = $(shell set -- $$(tr '\0' '\n' <
> /proc/device-tree/compatible | sed 's/.*,//'); echo "$$2-$$1") VERSION
> := $(shell ls -l vmlinuz | sed 's/.* -> vmlinuz-//')
>
> LN = ln -sf
> CP = cp
>
> all: boot.scr uinitrd.img $(MACHINE).dtb
>
> boot.scr: boot.cmd
>         mkimage -C none -A arm -T script -d $< $@
>
> uinitrd.img: uinitrd.img-$(VERSION) vmlinuz
>         $(LN) "$<" "$@"
>
> uinitrd.img-%: initrd.img-%
>         mkimage -A arm -T ramdisk -C none -n uInitrd -d "$<" "$@"
>
> $(MACHINE).dtb: $(MACHINE)-$(VERSION).dtb vmlinuz
>         $(LN) "$<" "$@"
>
> $(MACHINE)-$(VERSION).dtb:
> /usr/lib/linux-image-$(VERSION)/$(MACHINE).dtb $(CP) "$<" "$@"


Thanks for any further clarification, Stefan Monnier.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>


Reply to: