From: Konrad Rzeszutek Wilk Date: Wed, 19 Jul 2017 11:03:51 -0400 Subject: [U-Boot] A80 (CubieBoard4) u-boot - what to inject in boot0 area? In-Reply-To: References: <20170718024018.GA10246@localhost.localdomain> Message-ID: <20170719150349.GA17050@localhost.localdomain> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, Jul 18, 2017 at 11:22:00AM +0800, Chen-Yu Tsai wrote: > "Hi, > > On Tue, Jul 18, 2017 at 10:40 AM, Konrad Rzeszutek Wilk > wrote: > > Hey, > > > > I am trying to install an U-boot from the upstream repo as it looks to have most (if not all?) > > of the features needed for the A80 board (Cubieboard4). > > > > I've built the uboot just fine (using the default ./configs/Cubieboard4_defconfig) > > .. > > ./tools/mkimage -A arm -T firmware -C none -O u-boot -a 0x2a000000 -e 0 -n "U-Boot 2017.07-00217-ge14b116 for sunxi board" -d u-boot.bin u-boot.img > > Image Name: U-Boot 2017.07-00217-ge14b116 fo > > Created: Wed Jul 12 22:11:53 2017 > > Image Type: ARM U-Boot Firmware (uncompressed) > > Data Size: 355711 Bytes = 347.37 KiB = 0.34 MiB > > Load Address: 2a000000 > > Entry Point: 00000000 > > > > And now I am trying to load it on the SD card and load it > > on a Cubieboard4, but it just hangs. > > > > If I use from the CC-A80-binaries[*1] git repo the "sdcard-fwbuild.sh" > > and put the two resulting binaries on the SD card it boots fine. > > > > But naturally the u-boot that is on the mentioned repo is from 2011 > > and I would like a more recent version. > > > > If I try to use the CC-A80-binaries[*1] git repo and the "sdcard-fwbuild.sh" > > with the upstream u-boot it complains very loudly - and the resulting > > binary is not created. > > > > I figured out that it must be due to the header which as the magic > > string of 'uboot' (which in [*2] is in arch/arm/cpu/armv7/sun9iw1/spare_head.c) > > > > In u-boot upstream I can set CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y > > which I did, but now I am struggling to figure out what I am > > suppose to put in there. Any ideas? Is there an tool to fill this > > area out? And more importantly, am I on the right track or is > > there something else that I a missing? > > > > I did look at board/sunxi/README.sunxi64 and it explained about the boot0 > > but that talks about A53 boards I have an A15 (armv7) - and > > 'arm-trusted-firmware' is all geared towards armv8. > > > > Hints of what I should do next? > > With ARMv7 Allwinner SoCs and mainline U-boot, boot0 is replaced with > U-boot SPL. The build process should generate a "u-boot-sunxi-with-spl.bin" > file, which is the SPL combined with U-boot proper at the correct offsets. > Just write that as you would the image built from "sdcard-fwbuild.sh", > that is at an offset of 8192 bytes on the SD card. Awesome! Next snag - I am hitting an issue with trying to boot Xen with it. Specifically I have: U-Boot SPL 2017.07-00217-ge14b1169c0 (Jul 18 2017 - 09:27:24) DRAM: 2048 MiB Trying to boot from MMC1 U-Boot 2017.07-00217-ge14b1169c0 (Jul 18 2017 - 09:27:24 -0400) Allwinner Technology CPU: Allwinner A80 (SUN9I) Model: Cubietech Cubieboard4 DRAM: 2 GiB MMC: SUNXI SD/MMC: 0, SUNXI SD/MMC: 1 *** Warning - bad CRC, using default environment In: serial at 07000000 Out: serial at 07000000 Err: serial at 07000000 U-Boot 2017.07-00217-ge14b1169c0 (Jul 18 2017 - 09:27:24 -0400) Allwinner Technology CPU: Allwinner A80 (SUN9I) Model: Cubietech Cubieboard4 DRAM: 2 GiB MMC: SUNXI SD/MMC: 0, SUNXI SD/MMC: 1 *** Warning - bad CRC, using default environment In: serial at 07000000 Out: serial at 07000000 Err: serial at 07000000 Net: No ethernet found. starting USB... No controllers found Hit any key to stop autoboot: 2  1  0 switch to partitions #0, OK mmc0 is current device Scanning mmc 0:1... Found U-Boot script /boot.scr reading /boot.scr 1687 bytes read in 19 ms (85.9 KiB/s) ## Executing script at 23100000 libfdt fdt_check_header(): FDT_ERR_BADMAGIC No FDT memory address configured. Please configure the FDT address via "fdt addr
" command. Aborting! No FDT memory address configured. Please configure the FDT address via "fdt addr
" command. Aborting! No FDT memory address configured. Please configure the FDT address via "fdt addr
" command. Aborting! No FDT memory address configured. Please configure the FDT address via "fdt addr
" command. Aborting! No FDT memory address configured. Please configure the FDT address via "fdt addr
" command. Aborting! No FDT memory address configured. Please configure the FDT address via "fdt addr
" command. Aborting! No FDT memory address configured. Please configure the FDT address via "fdt addr
" command. Aborting! No FDT memory address configured. Please configure the FDT address via "fdt addr
" command. Aborting! reading /xen 851976 bytes read in 121 ms (6.7 MiB/s) reading /zImage.dtb 16825 bytes read in 27 ms (608.4 KiB/s) reading /zImage 10233696 bytes read in 1153 ms (8.5 MiB/s) ## Flattened Device Tree blob at bec00000 Booting using the fdt blob at 0xbec00000 Using Device Tree in place at bec00000, end bec071b8 Starting kernel ... - UART enabled - - CPU 00000000 booting - - Xen must be entered in NS Hyp mode - - Please update the bootloader - - Boot failed - I couldn't see anything in uboot about enabling NS Hyp mode? In case you are wondering the boot.scr is generated from $mkimage -A arm -T script -d boot.xen boot.scr And boot.xen looks as so: # SUNXI Xen Boot Script # Addresses suitable for 1GB system, adjust as appropriate for a 2GB system. # Top of RAM: 0xc0000000 # Xen relocate addr 0xbfe00000 setenv kernel_addr_r 0xbf600000 # 8M setenv ramdisk_addr_r 0xbee00000 # 8M setenv fdt_addr 0xbec00000 # 2M setenv xen_addr_r 0xbea00000 # 2M setenv fdt_high 0xffffffff # Load fdt in place instead of relocating # Load xen/xen to ${xen_addr_r}. e.g. tftp, fatload or ext2load to ${xen_addr_r}. # see the following sections for details of booting from various devices. setenv bootargs "console=dtuart dtuart=/soc/serial at 07000000 dom0_mem=512M" # Load appropriate .dtb file to ${fdt_addr} e.g. tftp, fatload or ext2load to ${fdt_addr}. # see the following sections for details of booting from various devices. fdt addr ${fdt_addr} 0x40000 fdt resize fdt chosen fdt set /chosen \#address-cells <1> fdt set /chosen \#size-cells <1> # Load Linux arch/arm/boot/zImage to ${kernel_addr_r}. e.g. tftp, fatload or ext2load to ${kernel_addr_r}. # see the following sections for details of booting from various devices. fdt mknod /chosen module at 0 fdt set /chosen/module at 0 compatible "xen,linux-zimage" "xen,multiboot-module" fdt set /chosen/module at 0 reg <${kernel_addr_r} 0x${filesize} > fdt set /chosen/module at 0 bootargs "console=hvc0 ro root=/dev/sda1 clk_ignore_unused" fatload mmc 0 ${xen_addr_r} /xen # Load appropriate .dtb file to ${fdt_addr} fatload mmc 0 ${fdt_addr} /zImage.dtb # # Load Linux arch/arm/boot/zImage to ${kernel_addr_r} fatload mmc 0 ${kernel_addr_r} /zImage bootz ${xen_addr_r} - ${fdt_addr}