FIT 이미지에서 Initrd 크기가 증가하면 Uboot가 중단됩니다.

FIT 이미지에서 Initrd 크기가 증가하면 Uboot가 중단됩니다.

저는 FIT 다중 이미지(image + initrd + DTB)를 사용하여 arm64에서 Linux를 부팅합니다. initrd 크기를 16MB -> 20MB로 늘리면 보드가 "부팅 커널"에서 멈춥니다. 그러나 bootm의 로드 주소를 변경하면(0x2000000에서 0x1000000으로) 성공적으로 부팅됩니다. 더 낮은 로드 주소에서 부팅되는 이유에 대한 조언이 있습니까? bootm 다중 이미지 로딩 주소와 Image, initrd, FDT의 최종 점프 주소 사이에는 어떤 관계가 있나요?

FIT bin이 0x2000000에 로드되면 커널이나 DTB를 덮어쓰는 것 같습니다. JTAG를 연결하면 커널이 head.S로 점프하지만 정의되지 않은 상태로 점프하는 것을 볼 수 있습니다.

  • 마더보드 구성: 2GB RAM(0x00000000 - 0x8000000)
  • Init high가 활성화되었습니다(따라서 initrd는 high 메모리로 재배치됩니다).
  • FDT_high=0xffffffffffffffff이므로 DTB가 제자리에 사용됩니다.
  • FDT 로딩 주소는 (0x9000000)입니다.

콘솔 출력:

## Current stack ends at 0x7f6cc6c0 *  kernel: cmdline image address = 0x02000000
## Loading kernel from FIT Image at 02000000 ... 
Using 'config@1' configuration 
Verifying Hash Integrity ... OK 
Trying 'kernel@0' kernel subimage 
 Description:  linux-mvl-4.4 
 Type:         Kernel Image 
 Compression:  uncompressed 
 Data Start:   0x020000bc 
 Data Size:    12473856 Bytes = 11.9 MiB 
 Architecture: AArch64 
 OS:           Linux 
 Load Address: 0x00080000 
 Entry Point:  0x00080000 
Verifying Hash Integrity ... OK 
kernel data at 0x020000bc, len = 0x00be5600 (12473856) 
*  ramdisk: using config 'config@1' from image at 0x02000000 
## Loading ramdisk from FIT Image at 02000000 ... 
Using 'config@1' configuration 
Trying 'ramdisk@0' ramdisk subimage 
 Description:  initramfs 
 Type:         RAMDisk Image 
 Compression:  lzma compressed 
 Data Start:   0x02be5764 
 Data Size:    22356891 Bytes = 21.3 MiB 
 Architecture: AArch64 
 OS:           Linux 
Can't get 'load' property from FIT 0x02000000, node: offset 12474104,    
name ramdisk@0 (FDT_ERR_NOTFOUND) 
 Load Address: unavailable 
Can't get 'entry' property from FIT 0x02000000, node: offset 12474104, name ramdisk@0 (FDT_ERR_NOTFOUND)
Entry Point:  unavailable 
Verifying Hash Integrity ... OK
Can't get 'load' property from FIT 0x02000000, node: offset 12474104, name 
ramdisk@0 (FDT_ERR_NOTFOUND) 
ramdisk start = 0x02be5764, ramdisk end = 0x04137aff 
*  fdt: using config 'config@1' from image at 0x02000000 
## Checking for 'FDT'/'FDT Image' at 02000000 
## Loading fdt from FIT Image at 02000000 ... 
Using 'config@1' configuration 
Trying 'fdt@1' fdt subimage 
  Description:  P1 fdt 
  Type:         Flat Device Tree 
  Compression:  uncompressed 
  Data Start:   0x0413eadc 
  Data Size:    28899 Bytes = 28.2 KiB 
  Architecture: AArch64 
 Verifying Hash Integrity ... OK 
 Loading fdt from 0x0413eadc to 0x09000000 
 Booting using the fdt blob at 0x9000000 
 of_flat_tree at 0x09000000 size 0x000070e3 
 Loading Kernel Image ... OK 
 kernel loaded at 0x00080000, end = 0x00c65600 
 ## initrd_high = 0x80000000, copy_to_ram = 1 
 Loading Ramdisk to 7e179000, end 7f6cb39b ... OK 
ramdisk load start = 0x7e179000, ramdisk load end = 0x7f6cb39b 
using: FDT 
## DT length 41187 
Using Device Tree in place at 0000000009000000, end 000000000900a0e2 
mci_find_sb_node.....no Device found 
DevID=100001f found on MCi bus 0 
DevID=1000021 found on MCi bus 1 
## Transferring control to Linux (at address 80000)... 

######## Starting kernel ...

인쇄 환경:

baudrate=115200 
bl_ver=rxam-c1_V0.0.9.5
bootargs=console=ttyS0,115200 root=/dev/ram rw mtdparts=pxa3xx_nand-     0:1m(oops),1m(reserved),-(fs) ubi.mtd=fs
bootcmd=run bootcmd_nand
bootcmd_nand=nand read $fdt_addr 0x000000 0x100000&&nand read $loadaddr     0x100000 0x1200000&&setenv bootargs $console ubi.mtd=9,4096   root=ubi0:rootfs rootfstype=ubifs rw chk_data_crc rootdelay=2&&mochi reset&& mochi init&& mochi init armada70x0_1 &&booti $loadaddr - $fdt_addr
bootcmd_usb=setenv dtb_image armada-3900-axis_$fw_ver.dtb && set       kernel_image Image_$fw_ver && usb reset; ext2load usb 0:1 $loadaddr $kernel_image; ext2load usb 0:1 $fdt_addr $dtb_image; setenv bootargs $console root=/dev/sda1 rw rootdelay=2; mochi reset&& mochi init&& mochi init armada70x0_1&& booti $loadaddr - $fdt_addr
bootdelay=2
bootfile=/tftpboot/gpxelinux.0
boottftp=tftp 0x2000000 /tftpboot/part.bin && bootm 0x2000000
console=console=ttyS0,115200
eraseenv=env default -fa &&saveenv
ethact=mvpp2-0
ethprime=mvpp2-0
fdt_addr=0x1000000
fdt_high=0xffffffffffffffff
fdtcontroladdr=7f6ccca0 
fw_ver=rxam-c1_V0.0.9.5
gatewayip=10.4.50.254
hostname=Axel
ipaddr=192.168.1.1
kernel_addr=0x2000000
loadaddr=0x2000000
mtddevname=fs
mtddevnum=0
mtdids=nand0=pxa3xx_nand-0
mtdparts=mtdparts=pxa3xx_nand-0:1m(oops),1m(reserved),-(fs)
nad=setenv dtb_image armada-3900-axis_$fw_ver.dtb && tftpboot $fdt_addr  $dtb_image&&nand erase 0x000000 0x100000&&nand write $fdt_addr 0x000000 $filesize
naf=setenv fs_image rootfs_$fw_ver.ubi && tftpboot $loadaddr $fs_image  &&nand erase 0x1300000 0x1EB00000&&nand write $loadaddr 0x1300000 $filesize
nak=setenv kernel_image Image_$fw_ver && tftpboot $loadaddr $kernel_image &&nand erase 0x100000 0x1200000&&nand write $loadaddr 0x100000 $filesize
netmask=255.255.255.0
nob=setenv bl_image flash-image_$bl_ver.bin && tftpboot $loadaddr  $bl_image &&sf probe 0:0 && sf update $loadaddr 0 $filesize
partition=nand0,0
preboot=printenv bl_ver;printenv fw_ver
rootpath=/srv/nfs/
serverip=172.19.35.87
set_bootargs=setenv bootargs $console $root    ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:none       nfsroot=$serverip:$rootpath $extra_params
stderr=serial@512000
stdin=serial@512000
stdout=serial@512000
tftpdir=/tftpboot/gumulla
upgradeall=run naf &&run nak &&run nad &&run nob&& reset

. 그것은:

/*
 * U-boot FIT source file
 */

/dts-v1/;

/ {
        description = "platform-config";
        #address-cells = <1>;

        images {
                kernel@0 {
                        description = "linux-mvl-4.4";
                        data = /incbin/("Image");
                        type = "kernel";
                        arch = "arm64";
                        os = "linux";
                        compression = "none";
                        load = <0x80000>;
                        entry = <0x80000>;
                };

                ramdisk@0 {
                        description = "initramfs";
                        data = /incbin/("initramfs.lzma");
                        type = "ramdisk";
                        arch = "arm64";
                        os = "linux";
                        compression = "lzma";
                };

                /* P0 fdt */
                fdt@0 { 
                        description = "P0 fdt";
                        data = /incbin/("z1-sgmii-1g.dtb");
                        type = "flat_dt";
                        arch = "arm64";
                        compression = "none";
                        load = <0x9000001>;
                };

                /* P1 fdt */
                fdt@1 { 
                        description = "P1 fdt";
                        data = /incbin/("db-axis.dtb");
                        type = "flat_dt";
                        arch = "arm64";
                        compression = "none";
                        load = <0x9000000>;
                };
        };

        configurations {
                default = "config@0";

                /* P0 image */
                config@0 {
                        description = "P0 image";
                        kernel = "kernel@0";
                        ramdisk = "ramdisk@0";
                        fdt = "fdt@0";
                        hash@1 {
                                algo = "sha1";
                        };
                };

                /* P1 image */
                config@1 {
                        description = "P1 image";
                        kernel = "kernel@0";
                        fdt = "fdt@1";
                        ramdisk = "ramdisk@0";
                        hash@1 {
                                algo = "sha1";
                        };
                };
        };
};

uboot 재배치가 활성화된 후 새 로그:

## Current stack ends at 0x7f6cc6c0 *  kernel: cmdline image address = 0x02000000
## Loading kernel from FIT Image at 02000000 ...
Using 'config@1' configuration
Verifying Hash Integrity ... OK
Trying 'kernel@0' kernel subimage
  Description:  linux-mvl-4.4
  Type:         Kernel Image
  Compression:  uncompressed
  Data Start:   0x020000bc
  Data Size:    12473856 Bytes = 11.9 MiB
  Architecture: AArch64
  OS:           Linux
  Load Address: 0x00080000
  Entry Point:  0x00080000
Verifying Hash Integrity ... OK
kernel data at 0x020000bc, len = 0x00be5600 (12473856)
*  ramdisk: using config 'config@1' from image at 0x02000000
## Loading ramdisk from FIT Image at 02000000 ...
Using 'config@1' configuration
Trying 'ramdisk@0' ramdisk subimage
 Description:  initramfs
 Type:         RAMDisk Image
 Compression:  lzma compressed
 Data Start:   0x02be5764
 Data Size:    22365017 Bytes = 21.3 MiB
 Architecture: AArch64
 OS:           Linux
Can't get 'load' property from FIT 0x02000000, node: offset 12474104, name ramdisk@0 (FDT_ERR_NOTFOUND)
 Load Address: unavailable
Can't get 'entry' property from FIT 0x02000000, node: offset 12474104, name ramdisk@0 (FDT_ERR_NOTFOUND)
 Entry Point:  unavailable
 Verifying Hash Integrity ... OK
Can't get 'load' property from FIT 0x02000000, node: offset 12474104, name ramdisk@0 (FDT_ERR_NOTFOUND)
ramdisk start = 0x02be5764, ramdisk end = 0x04139abd
*  fdt: using config 'config@1' from image at 0x02000000
## Checking for 'FDT'/'FDT Image' at 02000000
## Loading fdt from FIT Image at 02000000 ...
Using 'config@1' configuration
Trying 'fdt@1' fdt subimage
 Description:  P1 fdt
 Type:         Flat Device Tree
 Compression:  uncompressed
 Data Start:   0x04140a8c
 Data Size:    28899 Bytes = 28.2 KiB
 Architecture: AArch64
Verifying Hash Integrity ... OK
Loading fdt from 0x04140a8c to 0x09000000
Booting using the fdt blob at 0x9000000
of_flat_tree at 0x09000000 size 0x000070e3
Loading Kernel Image ... OK
kernel loaded at 0x00080000, end = 0x00c65600
## initrd_high = 0x80000000, copy_to_ram = 1
Loading Ramdisk to 7e177000, end 7f6cb359 ... OK
ramdisk load start = 0x7e177000, ramdisk load end = 0x7f6cb359
using: FDT
## DT length 41187
## device tree at 0000000009000000 ... 00000000090070e2 (len=41187 [0xA0E3])
Loading Device Tree to 000000007e16c000, end 000000007e1760e2 ... OK
mci_find_sb_node.....no Device found
DevID=100001f found on MCi bus 0
DevID=1000021 found on MCi bus 1
## Transferring control to Linux (at address 80000)...

######## Starting kernel ...

## Transferring control to Linux Done!

답변1

따라서 OP가 언급했듯이 로딩 주소를 이동하면 문제가 해결됩니다. 이는 사용의 위험성을 강조합니다.fdt_높음(또는 다른 경우에는높게 초기화)는 U-Boot가 콘텐츠를 재배치하는 것을 방지합니다. FIT 이미지와 같은 경우 U-Boot는 일반적으로 사용하려는 각 부품의 크기를 잘 알고 있습니다.부츠 크기운영 체제 부팅 콘텐츠를 재배치할 때 사용할 메모리 양(첫 번째 뱅크부터 시작)을 U-Boot에 알려줍니다. 이 특정한 경우에는 initrd가 높은 메모리에 있도록 하고 특정 값을 사용해야 합니다.fdt_높음이는 커널이 볼 수 있는 공간 내에 있습니다(경우에 따라 아키텍처 및 커널 버전에 따라 linux/Documentation/arm64/booting.txt와 같은 운영 체제 설명서 참조).

답변2

이미지 크기가 커지면 ARM psi의 예약된 영역에 액세스하는 것으로 나타났습니다. 어떤 식으로든 이미지 크기가 커질 때마다 시작 시 주소가 터치되지 않도록 해야 합니다.

답변3

사용 가능한 DRAM 크기, 커널 크기, itb를 로드하기 위해 선택한 clobstart를 기반으로 커널 및 fdt 노드에 대한 항목 및 로드 속성 값을 다시 계산해야 합니다.

관련 정보