Re: [External] - Raspberry Pi Boot 1b / Uboot boot failure with large initramfs

2021-12-06 Thread Frederik Lotter
Hi Vincent!

On Mon, 6 Dec 2021 at 16:36, Vincent Fazio  wrote:

> Frederick
>
>
> > -Original Message-
> > From: U-Boot  On Behalf Of Frederik Lotter
> > Sent: Monday, December 6, 2021 12:55 AM
> > To: u-boot@lists.denx.de
> > Subject: [External] - Raspberry Pi Boot 1b / Uboot boot failure with
> large
> > initramfs
> >
> > Hi,
> >
> > I am facing intermittend boot failures resulting in a data abort. Boot
> log and
> > environment attached below. The uboot is built with rpi_defconfig with
> > OF_BOARD to get uboot to pass through the FDT.
> >
> > Note:
> >
> > (1) If I boot this image directly using the RPI bootloader, the kernel
> (with
> > initramfs embedded) boots fine consistently.
> >
> > (2) However, I get inconsistent failures with uboot. My gut tells me
> memory
> > is getting corrupted.
> >
> > (3) Sometimes just adding one option to the bootargs breaks the next
> boot.
> >
> > (4) It seems the FDT address changes slightly (see failed vs OK). Not
> sure if
> > this is expected from start.elf (I assume the FDT address is supplied to
> u-
> > boot).
> >
> > (5) Is the size of the image overwriting anything in u-boot? I am not
> that
> > familiar with the u-boot memory map.
> >
> > I boot using the following environment changes:
> > bootargs=bootslot=a console=ttyAMA0,115200 root=/dev/null
> > bootcmd=fatload mmc 0:1 ${kernel_addr_r}  kernel.a.img ;  bootz
> > ${kernel_addr_r} - ${fdtcontroladdr}
>
> Do you have the same problems when using ${fdt_addr}?
>

I found a patch proposal where someone suggested that ${fdtcontroladdr} and
${fdt_addr} could end up being saved in the environment (saveenv), and
causing a old value getting loaded.

This resulted me in doing two things, which fixed the issue:

(1) Remove both these environment variables (env delete) before saving

(2) Using ${fdt_addr} for bootz

Everything now works perfectly.

Would you mind clarifying the difference between ${fdtcontroladdr} and
${fdt_addr}? I got the impression I had to use ${fdtcontroladdr} with
CONFIG_OF_BOARD, but that could have been a faulty source of information.


>
> >
> > Any ideas?
> >
> > Regards,
> > Fred
> >
> > BOOT:
> >
> > DRAM:  448 MiB
> > RPI Model B rev2 (0xe)
> > MMC:   mmc@7e202000: 0
> > Loading Environment from FAT... OK
> > In:serial
> > Out:   vidconsole
> > Err:   vidconsole
> > Net:   No ethernet found.
> > starting USB...
> > Bus usb@7e98: usb dr_mode not found
> > USB DWC2
> > scanning bus usb@7e98 for devices... 3 USB Device(s) found
> >scanning usb for storage devices... 0 Storage Device(s) found Hit
> any key
> > to stop autoboot:  0
> > 70746744 bytes read in 2940 ms (22.9 MiB/s) Kernel image @ 0x08 [
> > 0x00 - 0x4378278 ] ## Flattened Device Tree blob at 1bb500e0
> >Booting using the fdt blob at 0x1bb500e0
> >Using Device Tree in place at 1bb500e0, end 1bb59ebe data abort
> > pc : [<1bf5c4ec>]  lr : [<1bf5c7c4>]
> > reloc pc : [<94ec>]lr : [<97c4>]
> > sp : 1bb4fdb8  ip : 000c fp : 0003
> > r10:   r9 : 1bb56ec0 r8 : 1bb6bad4
> > r7 :   r6 : 0008 r5 : 1bfc5874  r4 : 0400
> > r3 : 0074616d  r2 : 1bb6bad4 r1 : 0400  r0 : 1bfc5874
> > Flags: nzcv  IRQs off  FIQs off  Mode SVC_32
> > Code: e12fff1e e92d4073 e5993000 e5906060 (e5933038) Resetting CPU ...
> >
> > resetting ...
> >
> > ENV:
> >
> > arch=arm
> > baudrate=115200
> > board=rpi
> > board_name=Model B rev2
> > board_rev=0xE
> > board_rev_scheme=0
> > board_revision=0xE
> > boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr}
> > ${prefix}${script}; source ${scriptaddr} boot_efi_binary=load ${devtype}
> > ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if
> fdt
> > addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else
> > bootefi ${kernel_addr_r} ${fdtcontroladdr};fi boot_efi_bootmgr=if fdt
> addr
> > ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
> > boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any
> > ${scriptaddr} ${prefix}${boot_syslinux_conf} boot_net_usb_start=usb start
> > boot_prefixes=/ /boot/ boot_script_dhcp=boot.scr.uimg
> > boot_scripts=boot.scr.uimg boot.scr
> > boot_syslinux_conf=extlinux/extlinux.conf
> > boot_targets=mmc0 mmc1 usb0 pxe dhcp
> > bootargs=bootslot=a console=ttyAMA0,115200 root=/dev/null
> > bootcmd=fatload mmc 0:1 ${kernel_addr_r}  kernel.a.img ;  bootz
> > ${kernel_addr_r} - ${fdtcontroladdr} bootcmd_dhcp=devtype=dhcp; run
> > boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then
> source
> > ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}"
> -a -n
> > "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi;
> setenv
> > efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv
> > bootp_vci PXEClient:Arch:00010:UNDI:003000;setenv bootp_arch 0xa;if dhcp
> > ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt
> addr

RE: [External] - Raspberry Pi Boot 1b / Uboot boot failure with large initramfs

2021-12-06 Thread Vincent Fazio
Frederick


> -Original Message-
> From: U-Boot  On Behalf Of Frederik Lotter
> Sent: Monday, December 6, 2021 12:55 AM
> To: u-boot@lists.denx.de
> Subject: [External] - Raspberry Pi Boot 1b / Uboot boot failure with large
> initramfs
> 
> Hi,
> 
> I am facing intermittend boot failures resulting in a data abort. Boot log and
> environment attached below. The uboot is built with rpi_defconfig with
> OF_BOARD to get uboot to pass through the FDT.
> 
> Note:
> 
> (1) If I boot this image directly using the RPI bootloader, the kernel (with
> initramfs embedded) boots fine consistently.
> 
> (2) However, I get inconsistent failures with uboot. My gut tells me memory
> is getting corrupted.
> 
> (3) Sometimes just adding one option to the bootargs breaks the next boot.
> 
> (4) It seems the FDT address changes slightly (see failed vs OK). Not sure if
> this is expected from start.elf (I assume the FDT address is supplied to u-
> boot).
> 
> (5) Is the size of the image overwriting anything in u-boot? I am not that
> familiar with the u-boot memory map.
> 
> I boot using the following environment changes:
> bootargs=bootslot=a console=ttyAMA0,115200 root=/dev/null
> bootcmd=fatload mmc 0:1 ${kernel_addr_r}  kernel.a.img ;  bootz
> ${kernel_addr_r} - ${fdtcontroladdr}

Do you have the same problems when using ${fdt_addr}?

> 
> Any ideas?
> 
> Regards,
> Fred
> 
> BOOT:
> 
> DRAM:  448 MiB
> RPI Model B rev2 (0xe)
> MMC:   mmc@7e202000: 0
> Loading Environment from FAT... OK
> In:serial
> Out:   vidconsole
> Err:   vidconsole
> Net:   No ethernet found.
> starting USB...
> Bus usb@7e98: usb dr_mode not found
> USB DWC2
> scanning bus usb@7e98 for devices... 3 USB Device(s) found
>scanning usb for storage devices... 0 Storage Device(s) found Hit any 
> key
> to stop autoboot:  0
> 70746744 bytes read in 2940 ms (22.9 MiB/s) Kernel image @ 0x08 [
> 0x00 - 0x4378278 ] ## Flattened Device Tree blob at 1bb500e0
>Booting using the fdt blob at 0x1bb500e0
>Using Device Tree in place at 1bb500e0, end 1bb59ebe data abort
> pc : [<1bf5c4ec>]  lr : [<1bf5c7c4>]
> reloc pc : [<94ec>]lr : [<97c4>]
> sp : 1bb4fdb8  ip : 000c fp : 0003
> r10:   r9 : 1bb56ec0 r8 : 1bb6bad4
> r7 :   r6 : 0008 r5 : 1bfc5874  r4 : 0400
> r3 : 0074616d  r2 : 1bb6bad4 r1 : 0400  r0 : 1bfc5874
> Flags: nzcv  IRQs off  FIQs off  Mode SVC_32
> Code: e12fff1e e92d4073 e5993000 e5906060 (e5933038) Resetting CPU ...
> 
> resetting ...
> 
> ENV:
> 
> arch=arm
> baudrate=115200
> board=rpi
> board_name=Model B rev2
> board_rev=0xE
> board_rev_scheme=0
> board_revision=0xE
> boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr}
> ${prefix}${script}; source ${scriptaddr} boot_efi_binary=load ${devtype}
> ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt
> addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else
> bootefi ${kernel_addr_r} ${fdtcontroladdr};fi boot_efi_bootmgr=if fdt addr
> ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
> boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any
> ${scriptaddr} ${prefix}${boot_syslinux_conf} boot_net_usb_start=usb start
> boot_prefixes=/ /boot/ boot_script_dhcp=boot.scr.uimg
> boot_scripts=boot.scr.uimg boot.scr
> boot_syslinux_conf=extlinux/extlinux.conf
> boot_targets=mmc0 mmc1 usb0 pxe dhcp
> bootargs=bootslot=a console=ttyAMA0,115200 root=/dev/null
> bootcmd=fatload mmc 0:1 ${kernel_addr_r}  kernel.a.img ;  bootz
> ${kernel_addr_r} - ${fdtcontroladdr} bootcmd_dhcp=devtype=dhcp; run
> boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source
> ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n
> "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; setenv
> efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv
> bootp_vci PXEClient:Arch:00010:UNDI:003000;setenv bootp_arch 0xa;if dhcp
> ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr
> ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi
> ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci
> ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv
> efi_old_arch;setenv efi_old_vci; bootcmd_mmc0=devnum=0; run
> mmc_boot bootcmd_mmc1=devnum=1; run mmc_boot bootcmd_pxe=run
> boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
> bootcmd_usb0=devnum=0; run usb_boot
> bootdelay=2
> cpu=arm1176
> dhcpuboot=usb start; dhcp u-boot.uimg; bootm distro_bootcmd=for target
> in ${boot_targets}; do run bootcmd_${target}; done efi_dtb_prefixes=/
> /dtb/ /dtb/current/
> ethaddr=b8:27:eb:46:ba:40
> fdt_addr=1bfe9200
> fdt_addr_r=0x0260
> fdt_high=
> fdtcontroladdr=1bb500e0
> fdtfile=bcm2835-rpi-b-rev2.dtb
> initrd_high=
> kernel_addr_r=0x0008
> load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart}