Welcome! Log In Create A New Profile

Advanced

[NSA325] I'm having trouble building the uInitrd

Posted by Dźwiedziu 
[NSA325] I'm having trouble building the uInitrd
May 15, 2022 09:42AM
I'm having trouble with installing newer, > 5.14.9 (still I've also managed to break it in another way) kernels. 5.15.5 and 5.17.4 at least. And I don't have an idea what to do about it.


U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:42:03 -0700)
ZyXEL NSA325 2-Bay Power Media Server

SoC:   Kirkwood 88F6282_A1
DRAM:  512 MiB
WARNING: Caches not enabled
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
MV88E1318 PHY initialized on egiga0
Hit any key to stop autoboot: 10  9  8  7  6  5  4  3  2  1  0 
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 
Use USB retry period from the environment: 15 second(s)
1 Storage Device(s) found

Reset IDE: ide_preinit failed
Unknown command 'mmc' - try 'help'

Partition Map for USB device 0  --   Partition Type: DOS

Part  Start Sector  Num Sectors UUID    Type
  1 2048        31258624    aa673fa1-01 83

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0
loading envs from usb 0 ...
39 bytes read in 692 ms (0 Bytes/s)

no IDE devices available
Unknown command 'mmc' - try 'help'
importing envs ...
running scan_disk ...
Scan device usb
device usb 0:1
1 bytes read in 477 ms (0 Bytes/s)
Found bootable drive on usb 0
loading uImage ...
5702912 bytes read in 768 ms (7.1 MiB/s)
loading uInitrd ...
12783094 bytes read in 1186 ms (10.3 MiB/s)
loading DTB /boot/dts/kirkwood-nsa325.dtb ...
14014 bytes read in 3075 ms (3.9 KiB/s)
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-5.17.4-kirkwood-tld-1
   Created:      2022-05-15  13:16:26 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5702848 Bytes = 5.4 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 01100000 ...
   Image Name:   initramfs-5.17.4-kirkwood-tld-1
   Created:      2022-05-15  13:16:28 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    12783030 Bytes = 12.2 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... Bad Data CRC
Error occured, error code = 12
Ramdisk image is corrupt or invalid
NSA325>

This is my mkimage's output.

# mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-5.17.4-kirkwood-tld-1 -d vmlinuz-5.17.4-kirkwood-tld-1 uImage &&
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-5.17.4-kirkwood-tld-1 -d initrd.img-5.17.4-kirkwood-tld-1 uInitrd
Image Name:   Linux-5.17.4-kirkwood-tld-1
Created:      Sun May 15 15:16:26 2022
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    5702848 Bytes = 5569.19 KiB = 5.44 MiB
Load Address: 00008000
Entry Point:  00008000
Image Name:   initramfs-5.17.4-kirkwood-tld-1
Created:      Sun May 15 15:16:28 2022
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    12783030 Bytes = 12483.43 KiB = 12.19 MiB
Load Address: 00000000
Entry Point:  00000000
Re: [NSA325] I'm having trouble building the uInitrd
May 15, 2022 10:51AM
*Is* initrd.img-5.17.4-kirkwood-tld-1 gzip compressed?
Re: [NSA325] I'm having trouble building the uInitrd
May 15, 2022 11:27AM
`file` says yes:

file /media/root/rootfs/boot/initrd.img-5.17.4-kirkwood-tld-1 
/media/root/rootfs/boot/initrd.img-5.17.4-kirkwood-tld-1: gzip compressed data, was "mkinitramfs-MAIN_ZBkgNW", last modified: Sun May 15 13:12:59 2022, from Unix, original size modulo 2^32 31927296
Re: [NSA325] I'm having trouble building the uInitrd
May 15, 2022 03:46PM
Dźwiedziu ,

Use 5.17.4-kirkwood-tld-1, interrupt serial console at count down

> Hit any key to stop autoboot:

And then set the load address of load_dtb_addr to 0x2c00000 and boot.

setenv load_dtb_addr 0x2c00000
boot


=========

I've just recall I already wrote this on the u-boot installation thread:

Quote

B. Load addresses for large systems

This u-boot was released in 2017, since then the kernel size has grown quite a bit. So if you intend to run apps or frameworks that take up a lot of space for initrd, you might need to adjust the load address of the DTB (load_dtb_addr). The default env is set up to allow 11MB uInitrd.

In particular, OMV4 running in the latest rootfs will result in the uInitrd larger than 11MB. So the load address of DTB must be moved farther out to accomodate the large uInitrd. This canbe done with 2 alternatives (B.1 or B.2).

B.1 Set the env permanently to give another 16MB to load uInitrd (i.e. allow for initrd that is up to 27 MB in size).

fw_setenv  load_dtb_addr 0x2c00000


B.2 Adjust load_dtb_addr in uEnv.txt

Add this line to uEnv.txt (see section C below). This setting is transient, i.e. not permanent. If the uEnv.txt exists in /boot folder, then it will be used during boot.

load_dtb_addr=0x2c00000


-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 3 time(s). Last edit at 05/15/2022 04:45PM by bodhi.
Re: [NSA325] I'm having trouble building the uInitrd
May 16, 2022 01:23AM
It works, log snip below, thanks!

Can you just tell me how do you calculate the addresses and do I need to recalculate for each new kernel or those just go straight to uEnv.txt/setenv?

==== >8 ====

Now the above I've wrote between your edits, so now I assume my questions answered ^_^J

==== >8 ====


importing envs ...                                                                                                                                                   
running scan_disk ...                                                                                                                                                
Scan device usb                                                                                                                                                      
device usb 0:1                                                                                                                                                       
1 bytes read in 477 ms (0 Bytes/s)                                                                                                                                   
Found bootable drive on usb 0                                                                                                                                        
loading uImage ...                                                                                                                                                   
5702912 bytes read in 768 ms (7.1 MiB/s)                                                                                                                             
loading uInitrd ...                                                                                                                                                  
12783094 bytes read in 1187 ms (10.3 MiB/s)                                                                                                                          
loading DTB /boot/dts/kirkwood-nsa325.dtb ...                                                                                                                        
14014 bytes read in 3075 ms (3.9 KiB/s)                                                                                                                              
## Booting kernel from Legacy Image at 00800000 ...                                                                                                                  
   Image Name:   Linux-5.17.4-kirkwood-tld-1                                                                                                                         
   Created:      2022-05-15  13:16:26 UTC                                                                                                                            
   Image Type:   ARM Linux Kernel Image (uncompressed)                                                                                                               
   Data Size:    5702848 Bytes = 5.4 MiB                                                                                                                             
   Load Address: 00008000                                                                                                                                            
   Entry Point:  00008000                                                                                                                                            
   Verifying Checksum ... OK                                                                                                                                         
## Loading init Ramdisk from Legacy Image at 02100000 ...                                                                                                            
   Image Name:   initramfs-5.17.4-kirkwood-tld-1                                                                                                                     
   Created:      2022-05-15  13:16:28 UTC                                                                                                                            
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)                                                                                                           
   Data Size:    12783030 Bytes = 12.2 MiB                                                                                                                           
   Load Address: 00000000                                                                                                                                            
   Entry Point:  00000000                                                                                                                                            
   Verifying Checksum ... OK                                                                                                                                         
## Flattened Device Tree blob at 03c00000                                                                                                                            
   Booting using the fdt blob at 0x3c00000                                                                                                                           
   Loading Kernel Image ... OK                                                                                                                                       
   Loading Ramdisk to 1eedc000, end 1fb0cdb6 ... OK                                                                                                                  
   Loading Device Tree to 1eed5000, end 1eedb6bd ... OK                                                                                                              
Using machid 0x831 from environment                                                                                                                                  
                                                                                                                                                                     
Starting kernel ...
Re: [NSA325] I'm having trouble building the uInitrd
May 16, 2022 01:39AM
> Now the above I've wrote between your edits, so
> now I assume my questions answered ^_^J

Cool :) glad you got the answer you need!

There is better way to ensure the load addresses are OK. But that will be for another day in the future when I will release new u-boot version.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: