0

I am trying a boot a custom kernel and bootloader on Raspberry Pi 4B.

I have generated linux kernel using buildroot using RPi4 Defconfig and compiled u-boot to boot this kernel. This I was able to achieve successfully. But now, I want to generate a Fit Image from the 'Image' generated by buildroot. I believe we can do this with the help of mkimage utility provided by u-boot, but I am not sure exactly how to do it. Also, I am not sure what should be the boot.scr to autoboot the to be generated FIT image. Any references or possible duplicate questions or any recommendation is extremely welcome. Banging my head on this for a while now, thanks for the help!!!


Edit - I have generated a fit image now, Running mkimage -l for the generated fit image gives this output

But while booting this up using a boot.scr as ,

setenv bootargs console=tty0 console=ttyAMA0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait 
fatload mmc 0 0x3000000 ritman.fit
bootm 0x3000000

The error that I am getting while using the above mentioned script and image is, u-boot output

Edit 2- Contents of the .its file

/dts-v1/;
/ {
    description = "RPi FIT Image";
    #address-cells = <2>;
    images {
        kernel-1 {
            description = "default kernel";
            data = /incbin/("Image");
            type = "kernel";
            arch = "arm64";
            os = "linux";
            compression = "none";
            load =  <0x00080000>;
            entry = <0x00080000>;
            hash@1 {
                algo = "sha1";
            };
        };
 
        haha {
            description = "device tree";
            data = /incbin/("bcm2711-rpi-4-b.dtb");
            type = "flat_dt";
            arch = "arm64";
            compression = "none";
            hash@1 {
                algo = "sha1";
            };
        };
    };
    configurations {
        default = "config-1";
        config-1 {
            description = "default configuration";
            kernel = "kernel-1";
            fdt = "haha";
            signature-1 {
                algo = "sha1,rsa2048";
                key-name-hint = "dev";
                sign-images = "fdt", "kernel";
            };
        };
    };
};
  • mkimage is correct. Here's the docs with example: https://www.systutorials.com/docs/linux/man/1-mkimage/ – stark Feb 03 '21 at 15:13
  • @stark Thanks for the reply. Actually I followed this and ended with this particular error. Not sure what am I getting wrong here? – RITWIK MANDAL Feb 04 '21 at 06:57
  • Please add the complete mkimage command that you are using. – stark Feb 04 '21 at 12:06
  • @stark $ ../u-boot/tools/mkimage -f fit.its -K bcm2711-rpi-4-b-pubkey.dtb -k keys -r ritman.fit This is the mkimage comand that I used. In /keys directory, used OpenSSL commands as - openssl genrsa -F4 -out keys/dev.key 2048 $ openssl req -batch -new -x509 -key keys/dev.key -out keys/dev.crt – RITWIK MANDAL Feb 04 '21 at 18:22

0 Answers0