Charly
Charly

Reputation: 1352

Linux Kernel - ERROR: Failed to allocate 0x6b3c bytes below 0x1000000

I'm including my rootfs (CONFIG_INITRAMFS_SOURCE) into my kernel, so the kernel has now a size of 17Mb:

$ ls -la uImage
-rw-r--r-- 1 kkr kkr 17669274 Dec  1 18:59 uImage
$ d2h 17669274
0x10D9C9A

Since it's compressed, it would occupied uncompressed 39Mb:

$ dd if=uImage of=uImage-x.gz bs=64 skip=1
$ file uImage-x.gz
uImage-x.gz: gzip compressed data, max compression, from Unix
$ gunzip uImage-x.gz
$ ls -la uImage-x 
-rw-r--r-- 1 kkr kkr 39852288 Dec  1 19:18 uImage-x
$ d2h 39852288
0x2601900

Why cannot I start my kernel via uBoot with this commands?

=> setenv bootargs console=$consoledev,$baudrate $othbootargs

=> tftp 0x3000000 $bootfile
Speed: 100, half duplex
Using eTSEC1 device
TFTP from server 192.168.32.3; our IP address is 192.168.32.32
Filename 'uImage-powerpc'.
Load address: 0x3000000
Loading: #####################################################
done
Bytes transferred = 17669274 (10d9c9a hex)

=> tftp  0x2700000 $fdtfile;
Speed: 100, half duplex
Using eTSEC1 device
TFTP from server 192.168.32.3; our IP address is 192.168.32.32
Filename 'sat_92107.100.00C_p2020.dtb'.
Load address: 0x2700000
Loading: ##
done
Bytes transferred = 15164 (3b3c hex)

=> bootm 0x3000000 - 0x2700000
## Booting kernel from Legacy Image at 03000000 ...
   Image Name:   Linux-4.0.0-AOA00.01-00662-g07ae
   Created:      2015-12-01  17:59:21 UTC
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    17669210 Bytes = 16.9 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 02700000
   Booting using the fdt blob at 0x02700000
   Uncompressing Kernel Image ... OK
ERROR: Failed to allocate 0x6b3c bytes below 0x1000000.
device tree - allocation error

Since the kernel itself needs 0x10d9c9a bytes (compressed) or 0x2601900 bytes (uncompressed) there is no chance to place the devicetree below 0x1000000. Is this value (16Mb) configurable? Does my extracted kernel have be less than 16Mb otherwise?

Upvotes: 3

Views: 2781

Answers (2)

michał frynas
michał frynas

Reputation: 11

I've experienced similar issue while trying to boot up FIT image within U-Boot 2022.10 on STM32MP15x features device.

   Loading Kernel Image
   Loading Ramdisk to cf8b0000, end cffff38d ... OK
ERROR: Failed to allocate 0x1e4ff bytes below 0xd0000000.
device tree - allocation error
FDT creation failed!

In my case the culprit was U-Boot config CONFIG_LMB_MAX_REGIONS defaulting to 8 whereas my DT defined 9 reserved-memory regions. U-Boot tried to relocate FDT from FIT image into RAM and failed, because it had already maximum number of memory regions allocated.

Upvotes: 0

u_Ltd.
u_Ltd.

Reputation: 544

Yes, this value is configurable in U-Boot by setting the environment variables bootm_low and bootm_size to hexadecimal values. In your case, it's 0x0 and 0x20000000, respectively.

See section "Environment Variables" of the big README file in the U-Boot source tree.

Upvotes: 2

Related Questions