sometimes ext4load a symbolic link to vmlinuz in emmc under u-boot 2016.03 fail

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sometimes ext4load a symbolic link to vmlinuz in emmc under u-boot 2016.03 fail

Jump to solution
1,131 Views
changbaoma
Contributor III

Hi,everyone

Recently i do a power-cut safe test to my imx6+debian board while doing linux-image(included vmlinuz-xxx  then create a symbolic link to it) package upgrade.There is a small probability that the board boot fail with vmlinuz not found, which is a symbolic link to vmlinuz-xxx.

U-Boot 2016.03 (Mar 25 2021 - 14:48:10 +0800)

CPU: Freescale i.MX6ULL rev1.1 69 MHz (running at 396 MHz)
CPU: Industrial temperature grade (-40C to 105C) at 46C
Reset cause: WDOG
Board: MX6ULL 14x14 EVK
I2C: ready
DRAM: 512 MiB
HAB: closed
MMC: FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: FEC1
Normal Boot
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc1(part 0) is current device
** File not found boot/vmlinuz **  (output cmd `ext4load mmc 1:2 80800000 boot/vmlinuz ` fial )

** File not found boot/vmlinuz.old ** 

=>

But i access to that emmc partition directory, i can see

=> mmc dev 1; ext4ls mmc 1:2 boot
switch to partitions #0, OK
mmc1(part 0) is current device
<DIR> 4096 .
<DIR> 4096 ..
5975896 vmlinuz-5.4.24-1.0.0
<SYM> 1609 vmlinuz.old
<SYM> 12754 vmlinuz
5975896 vmlinuz-5.4.24-0.0.9

I note that the sizes of  vmlinuz-5.4.24-1.0.0 vmlinuz-5.4.24-0.0.9 are correct. But the sizes of  symbolic link vmlinuz and vmlinuz.old are abnormal, which normally is 20.

Now  i switch to boot vmlinuz-5.4.24-1.0.0 directly into debian system and switch to the emmc partition, i see the the sizes of two symbolic link become to 20.

root@Router:/boot#

lrwxrwxrwx 1 root root 20 Apr 15 10:46 vmlinuz -> vmlinuz-5.4.24-0.0.9
-rw-r--r-- 1 root root 5975896 Mar 30 16:04 vmlinuz-5.4.24-0.0.9
-rw-r--r-- 1 root root 5975896 Mar 25 16:19 vmlinuz-5.4.24-1.0.0
lrwxrwxrwx 1 root root 20 Apr 15 10:46 vmlinuz.old -> vmlinuz-5.4.24-1.0.0

 

And the reset the board  and check the 2 symbolic link sizes and found that the size of symbolic link vmlinuz and vmlinuz.old became 20 again, then success to boot vmlinuz again.

=> ls mmc 1:2 /boot
<DIR> 4096 .
<DIR> 4096 ..
<SYM> 20 vmlinuz.old
<SYM> 20 vmlinuz

5975896 bytes read in 306 ms (18.6 MiB/s)
48984 bytes read in 196 ms (243.2 KiB/s)
Kernel image @ 0x80800000 [ 0x000000 - 0x5b1c78 ]
## Flattened Device Tree blob at 82000000
Booting using the fdt blob at 0x82000000

Authenticate image from DDR location 0x80800000...

Secure boot enabled

HAB Configuration: 0xcc, HAB State: 0x99
No HAB Events Found!

Loading Device Tree to 9ef43000, end 9ef50ee4 ... OK

Starting kernel ...  (Boot Successfull)

As you can see i do nothing this period, but the two symbolic link became ok autoly.

(i guess the  two symbolic link may were corrected while emmc is mounted as rootfs in debian system, which my had been broken by power-cut)

Any one have ideas?

0 Kudos
1 Solution
1,029 Views
b36401
NXP Employee
NXP Employee

As for recovering please try fsck.ext4 utility.
If the corrupred FS is located on SD-card you can symply attach it to Linux PC and run fsck.
Else you need to boot the board somehow with another image and run fsck internally.

View solution in original post

0 Kudos
3 Replies
1,126 Views
b36401
NXP Employee
NXP Employee

The size you see (20) means the size of "vmlinuz-5.4.24-0.0.9" name. At low level symlink only contains name of the file, not the content.

As for the issue I suppose it is not caused with the symlink but with filesystem accessibility.
To check that you can simply replace a symlink with the file itself:

# rm vmlinuz
# cp vmlinuz-5.4.24-0.0.9 vmlinuz

0 Kudos
1,121 Views
changbaoma
Contributor III

Thank you for your sharing @b36401 

The reversion of vmlinuz-5.4.24-x.x.x is unknown to u-boot, so i think "cp vmlinuz-5.4.24-x.x.x vmlinuz" is not appropriate. 

Any one known is it possible to recovery ext4 filesystem power-cut corruption in u-boot?

 

0 Kudos
1,030 Views
b36401
NXP Employee
NXP Employee

As for recovering please try fsck.ext4 utility.
If the corrupred FS is located on SD-card you can symply attach it to Linux PC and run fsck.
Else you need to boot the board somehow with another image and run fsck internally.

0 Kudos