bootloader启动参数传递(二)

1.dtb是怎么传递给kernel的?

首先base dtb是与kernel一起打包进boot.img中的,dtbo是一个单独分区存储,bootloader加载后整合后传递给kernel。

通过把地址赋值给对应的寄存器,从而让内核知道对应的dtb信息的,对于arm32,是r2寄存器;对于arm64,是x0寄存器。

2.ramdisk信息是怎么传递给kernel的?

ramdisk可以打包到kernel image中,如果是打包进kernel image的形式,那么在bootloader加载时不需要指定ramdisk参数。否则需要按照如下方式:

1.通过cmdline传入参数CONFIG_CMDLINE=“initrd=0x31000000,0x200000 root=/dev/ram”

2.通过atags传入参数bootargs=“initrd=0x31000000,0x200000 root=/dev/ram”

3.通过dtb传入,通过fdt_initrd函数设置一个“linux,initrd-start”和“linux,initrd-end”来选择对应的dtb;

3.Image/zImage/uImage的区别?

Image,为压缩的内核镜像;zImage,经过gzip压缩的镜像;uImage,uboot专用镜像,在zImage前加入了uboot header。

4.FIT-uImage是什么?

全称是flattened image tree uImage,为了更好的支持单个固件的通用性,类似于device tree机制,为了使单个kernel能够适应多个板型,所以uImage中加入多个dtb文件,和ramdisak文件,当然如果需要的话,同样可以支持多个kernel文件。这样同一个uImage就能够在uboot中选择特定的kernel/dtb和ramdisk进行启动了,达成也该uImage可以通用多个板型的目的。使用its文件来描述这个uImage的组成结构,并且编译时也需要此文件。


{

    description = "U-Boot uImage source file";

    #address-cells = <1>;



    images {

        kernel@tiny210 {

            description = "Unify(TODO) Linux kernel for project-x";

            data = /incbin/("out/linux/arch/arm/boot/zImage");

            type = "kernel";

            arch = "arm";

            os = "linux";

            compression = "none";

            load = <0x20008000>;

            entry = <0x20008000>;

        };

        fdt@tiny210 {

            description = "Flattened Device Tree blob for project-x";

            data = /incbin/("out/linux/arch/arm/boot/dts/s5pv210-tiny210.dtb");

            type = "flat_dt";

            arch = "arm";

            compression = "none";

        };

        ramdisk@tiny210 {

            description = "Ramdisk for project-x";

            data = /incbin/("out/rootfs/initramfs.gz");

            type = "ramdisk";

            arch = "arm";

            os = "linux";

            compression = "gzip";

        };

    };



    configurations {

        default = "conf@tiny210";

        conf@tiny210 {

            description = "Boot Linux kernel with FDT blob";

            kernel = "kernel@tiny210";

            fdt = "fdt@tiny210";

            ramdisk = "ramdisk@tiny210";

        };

    };

};

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值