0

I am not sure whether the following situation is normal.

I have the following command to boot to kernel from uboot:

set mtdids nand0=pxa3xx_nand-0
set mtdparts mtdparts=pxa3xx_nand-0:0x600000(boot)ro,0x400000(kernel),-(rootfs)
usb start
fatload usb 0:1 0x201000000 ubifs.img
nand erase.part rootfs; ubi part rootfs; ubi create nand_rootfs
ubi write 0x201000000 nand_rootfs $filesize
 
fatload usb 0:1 0x206000000 Image;
fatload usb 0:1 0x201000000 dtb.dtb;
set bootargs mem=2G console=ttyS0,115200 earlycon=uart8250,mmio32,0x7f012000 ubi.mtd=2 root=ubi0 rootfstype=ubifs rw cpuidle.off=1;

booti 0x206000000 - 0x201000000;

As you can see, since the Image and dtb are not stored internally, I have to plug in a USB to boot my device with this method. To get rid of using USB every time, I modified the cmds as follows:

set mtdparts mtdparts=pxa3xx_nand-0:0x600000(boot)ro,0x3200000(kernel),0x100000(dtb),0x100000(dtb_spare),0x5C80000(rootfs),-(rootfsubi);   //I will explain why I made that many partitions
set kernelsize 0x2916808;
set dtbsize 0x1f15;
set ubifsimgsize 0x2cc0ff0; 

nand erase.chip;usb start;
fatload usb 0:1 0x210000000 ubifs.img;
ubi part rootfs; ubi create nand_rootfs;
ubi write 0x210000000 nand_rootfs $ubifsimgsize;
nand write 0x210000000 rootfsubi $ubifsimgsize; // will be explained below

fatload usb 0:1 0x206000000 Image;
fatload usb 0:1 0x201000000 dtb.dtb;
nand write 0x206000000 kernel $kernelsize;
nand write 0x201000000 dtb $dtbsize;nand write 0x201000000 dtb_spare $dtbsize;

setenv boot_device 'nand read 0x206000000 kernel $kernelsize;nand read 0x201000000 dtb $dtbsize;set bootargs mem=2G console=ttyS0,115200 earlycon=uart8250,mmio32,0x7f012000 ubi.mtd=3 root=ubi0 rootfstype=ubifs rw cpuidle.off=1;booti 0x206000000 - 0x201000000;'
set boot_cmd run boot_device;

set bootargs mem=2G console=ttyS0,115200 earlycon=uart8250,mmio32,0x7f012000 ubi.mtd=2 root=ubi0 rootfstype=ubifs rw cpuidle.off=1;

saveenv

booti 0x206000000 - 0x201000000;

The first time boot using the above command was always successful. My problem happened when I reboot to uboot from kernel.

The "nand write" ubifs img appears because the ubi volume was gone but every time I boot to uboot from kernel. This command was meant to do the ubi device and volume process again without using USB.

Moreover, when the first time booted to the kernel, and reboot to enter uboot again, I discovered with the commands md address, ubi read and nand read that, the memory in the partition changed into UBI something. Please take a look at the picture below

Picture: Auto-changes to ubi something(?)

Basically all partition except the first 0x400000 bytes of kernel and boot behave as above when booted to uboot from kernel.

I did not find anything relevant online. I wonder if this is something normal when using ubi or ubifs to boot to kernel. Please let me know if you have any hints or clues about how to achieve booting to kernel without external USB.

Post the mtd part here if it matters: uboot>> mtd

device nand0 <pxa3xx_nand-0>, # parts = 6
 #: name                size            offset          mask_flags
 0: boot                0x00600000      0x00000000      1
 1: kernel              0x03200000      0x00600000      0
 2: dtb                 0x00100000      0x03800000      0
 3: dtb_spare           0x00100000      0x03900000      0
 4: rootfs              0x05c80000      0x03a00000      0
 5: rootfsubi           0x06980000      0x09680000      0

active partition: nand0,0 - (boot) 0x00600000 @ 0x00000000

defaults:
mtdids  :
mtdparts:
WillAi
  • 1
  • 1
  • "*I am not sure whether the following situation is normal*" -- Your boot procedure (that installs a rootfs) is not normal. "*Please let me know if you have any hints or clues about how to achieve booting to kernel without external USB*" -- Seem like the only available U-Boot is on the USB storage device, and no U-Boot binary is ever installed in NAND flash. You neglect to mention what SoC is used and its boot configuration. – sawdust Sep 09 '22 at 02:47

0 Answers0