[U-Boot] U-boot for Banana Pi

Hello,
I'm getting some troubles booting FreeBSD on Banana Pi. I wrote simple script that creates bootable SD card image for FreeBSD OS.
#!/bin/bash cd /root/banana rm /root/banana/banana.img truncate -s 940M banana.img mdconfig -f banana.img -u0 gpart create -s mbr md0 gpart add -b 1m -s 64m -t fat16 md0 gpart set -a active -i 1 md0 newfs_msdos -F 16 /dev/md0s1 mount_msdosfs /dev/md0s1 /mnt cp /usr/obj/arm.armv6/usr/src/sys/BANANAPI/kernel /mnt cd /usr/src/sunxi-tools echo "fatload mmc 0 0x40200000 kernel; go 0x40200100" > boot.cmd /usr/src/u-boot-bananapi/tools/mkimage -C none -A arm -T script -d boot.cmd boot.scr cp boot.scr /mnt umount /mnt mdconfig -d -u0 cd /root/banana # Original Banana Pi U-boot loader #dd if=/usr/src/u-boot-sunxi/spl/sunxi-spl.bin conv=notrunc of=banana.img bs=1024 seek=8 #dd if=/usr/src/u-boot-sunxi/u-boot.bin conv=notrunc of=banana.img bs=1024 seek=40 # Lemaker's U-boot loader dd if=/usr/src/u-boot-bananapi/spl/sunxi-spl.bin conv=notrunc of=banana.img bs=1024 seek=8 dd if=/usr/src/u-boot-bananapi/u-boot.bin conv=notrunc of=banana.img bs=1024 seek=40
The script output:
root@freebsd:~/banana # bash prepare_boot.sh md0 created md0s1 added active set on md0s1 /dev/md0s1: 130888 sectors in 16361 FAT16 clusters (4096 bytes/cluster) BytesPerSec=512 SecPerClust=8 ResSectors=1 FATs=2 RootDirEnts=512 Media=0xf0 FATsecs=64 SecPerTrack=17 Heads=255 HiddenSecs=0 HugeSectors=131053 Image Name: Created: Tue Aug 19 02:20:04 2014 Image Type: ARM Linux Script (uncompressed) Data Size: 55 Bytes = 0.05 kB = 0.00 MB Load Address: 00000000 Entry Point: 00000000 Contents: Image 0: 47 Bytes = 0.05 kB = 0.00 MB 23+1 records in 23+1 records out 24064 bytes transferred in 0.003972 secs (6058691 bytes/sec) 235+1 records in 235+1 records out 241544 bytes transferred in 0.003128 secs (77224557 bytes/sec)
Original Banana Pi U-boot loader output:
U-Boot SPL 2014.04-10704-gf625d1d (Aug 16 2014 - 23:44:23) Board: Bananapi DRAM: 1024 MiB CPU: 960000000Hz, AXI/AHB/APB: 3/2/2 spl: not an uImage at 1600 spl: not an uImage at 80 ### ERROR ### Please RESET the board ###
And Lemaker's:
U-Boot SPL 2014.04-10693-gf954935 (Aug 17 2014 - 21:41:27) Board: Bananapi DRAM: 1024 MiB CPU: 960000000Hz, AXI/AHB/APB: 3/2/2 spl: not an uImage at 1600 spl: not an uImage at 80 ### ERROR ### Please RESET the board ###
The only way it works is: # Cubieboard's 2 U-boot loader from FreeBSD Wiki dd if=sunxi-spl.bin conv=notrunc of=banana.img bs=1024 seek=8 dd if=u-boot.bin conv=notrunc of=banana.img bs=1024 seek=32
And according to https://github.com/linux-sunxi/u-boot-sunxi/wiki "If using v2013.07 or earlier then the procedure is slightly different dd if=spl/sunxi-spl.bin of=/dev/sdX bs=1024 seek=8 dd if=u-boot.bin of=/dev/sdX bs=1024 seek=32" but I'm using newer version.
I'm getting problems with addressing all available memory (0x40000000, size: 0x40000000 = 1024MB), I belive it's caused by Cubieboard's version of u-boot. The only way it works is 0x40000000 size 0x20000000 in kernel's memory addressing which is half of all available memory. So I have to use Cubieboard's 2 version of u-boot to start my board.
Cheers, TooMeeK

Hello,
On 20 August 2014 21:19, TooMeeK Admin maps@toomeek.waw.pl wrote:
Hello,
I'm getting some troubles booting FreeBSD on Banana Pi. I wrote simple script that creates bootable SD card image for FreeBSD OS.
#!/bin/bash cd /root/banana rm /root/banana/banana.img truncate -s 940M banana.img mdconfig -f banana.img -u0 gpart create -s mbr md0 gpart add -b 1m -s 64m -t fat16 md0 gpart set -a active -i 1 md0 newfs_msdos -F 16 /dev/md0s1 mount_msdosfs /dev/md0s1 /mnt cp /usr/obj/arm.armv6/usr/src/sys/BANANAPI/kernel /mnt cd /usr/src/sunxi-tools echo "fatload mmc 0 0x40200000 kernel; go 0x40200100" > boot.cmd /usr/src/u-boot-bananapi/tools/mkimage -C none -A arm -T script -d boot.cmd boot.scr cp boot.scr /mnt umount /mnt mdconfig -d -u0 cd /root/banana # Original Banana Pi U-boot loader #dd if=/usr/src/u-boot-sunxi/spl/sunxi-spl.bin conv=notrunc of=banana.img bs=1024 seek=8 #dd if=/usr/src/u-boot-sunxi/u-boot.bin conv=notrunc of=banana.img bs=1024 seek=40 # Lemaker's U-boot loader dd if=/usr/src/u-boot-bananapi/spl/sunxi-spl.bin conv=notrunc of=banana.img bs=1024 seek=8 dd if=/usr/src/u-boot-bananapi/u-boot.bin conv=notrunc of=banana.img bs=1024 seek=40
The script output:
root@freebsd:~/banana # bash prepare_boot.sh md0 created md0s1 added active set on md0s1 /dev/md0s1: 130888 sectors in 16361 FAT16 clusters (4096 bytes/cluster) BytesPerSec=512 SecPerClust=8 ResSectors=1 FATs=2 RootDirEnts=512 Media=0xf0 FATsecs=64 SecPerTrack=17 Heads=255 HiddenSecs=0 HugeSectors=131053 Image Name: Created: Tue Aug 19 02:20:04 2014 Image Type: ARM Linux Script (uncompressed) Data Size: 55 Bytes = 0.05 kB = 0.00 MB Load Address: 00000000 Entry Point: 00000000 Contents: Image 0: 47 Bytes = 0.05 kB = 0.00 MB 23+1 records in 23+1 records out 24064 bytes transferred in 0.003972 secs (6058691 bytes/sec) 235+1 records in 235+1 records out 241544 bytes transferred in 0.003128 secs (77224557 bytes/sec)
Original Banana Pi U-boot loader output:
U-Boot SPL 2014.04-10704-gf625d1d (Aug 16 2014 - 23:44:23) Board: Bananapi DRAM: 1024 MiB CPU: 960000000Hz, AXI/AHB/APB: 3/2/2 spl: not an uImage at 1600 spl: not an uImage at 80 ### ERROR ### Please RESET the board ###
And Lemaker's:
U-Boot SPL 2014.04-10693-gf954935 (Aug 17 2014 - 21:41:27) Board: Bananapi DRAM: 1024 MiB CPU: 960000000Hz, AXI/AHB/APB: 3/2/2 spl: not an uImage at 1600 spl: not an uImage at 80 ### ERROR ### Please RESET the board ###
The only way it works is: # Cubieboard's 2 U-boot loader from FreeBSD Wiki dd if=sunxi-spl.bin conv=notrunc of=banana.img bs=1024 seek=8 dd if=u-boot.bin conv=notrunc of=banana.img bs=1024 seek=32
And according to https://github.com/linux-sunxi/u-boot-sunxi/wiki "If using v2013.07 or earlier then the procedure is slightly different dd if=spl/sunxi-spl.bin of=/dev/sdX bs=1024 seek=8 dd if=u-boot.bin of=/dev/sdX bs=1024 seek=32" but I'm using newer version.
I'm getting problems with addressing all available memory (0x40000000, size: 0x40000000 = 1024MB), I belive it's caused by Cubieboard's version of u-boot. The only way it works is 0x40000000 size 0x20000000 in kernel's memory addressing which is half of all available memory. So I have to use Cubieboard's 2 version of u-boot to start my board.
Hello,
currently memory controller paramaters are set from constants defined in u-boot at compile time. U-boots needs to configure the memory controller so it has some place to load the kernel binary.
If your memory configuration is incorrect you might have stability problems or may not be able to access all memory. There is a10-meminfo tool http://linux-sunxi.org/Retrieving_device_information#Reading_memory_informat... which you can run on the original Android or GNU/Linux installation (if any) to determine what memory parameters the manufacturer used and configure your u-boot accordingly. Note that cubieboard1 and cubieboard2 use a different SoC so u-boot compiled for one might not configure the other correctly. Especially the SMP on a20 works correctly only with recent u-boot. You should use u-boot compiled for your SoC a10/a20/...
HTH
Michal

On Thu, 2014-08-21 at 10:48 +0200, Michal Suchanek wrote:
Hello,
On 20 August 2014 21:19, TooMeeK Admin maps@toomeek.waw.pl wrote:
Hello,
I'm getting some troubles booting FreeBSD on Banana Pi. I wrote simple script that creates bootable SD card image for FreeBSD OS.
#!/bin/bash cd /root/banana rm /root/banana/banana.img truncate -s 940M banana.img mdconfig -f banana.img -u0 gpart create -s mbr md0 gpart add -b 1m -s 64m -t fat16 md0 gpart set -a active -i 1 md0 newfs_msdos -F 16 /dev/md0s1 mount_msdosfs /dev/md0s1 /mnt cp /usr/obj/arm.armv6/usr/src/sys/BANANAPI/kernel /mnt cd /usr/src/sunxi-tools echo "fatload mmc 0 0x40200000 kernel; go 0x40200100" > boot.cmd /usr/src/u-boot-bananapi/tools/mkimage -C none -A arm -T script -d boot.cmd boot.scr cp boot.scr /mnt umount /mnt mdconfig -d -u0 cd /root/banana # Original Banana Pi U-boot loader #dd if=/usr/src/u-boot-sunxi/spl/sunxi-spl.bin conv=notrunc of=banana.img bs=1024 seek=8 #dd if=/usr/src/u-boot-sunxi/u-boot.bin conv=notrunc of=banana.img bs=1024 seek=40 # Lemaker's U-boot loader dd if=/usr/src/u-boot-bananapi/spl/sunxi-spl.bin conv=notrunc of=banana.img bs=1024 seek=8 dd if=/usr/src/u-boot-bananapi/u-boot.bin conv=notrunc of=banana.img bs=1024 seek=40
The script output:
root@freebsd:~/banana # bash prepare_boot.sh md0 created md0s1 added active set on md0s1 /dev/md0s1: 130888 sectors in 16361 FAT16 clusters (4096 bytes/cluster) BytesPerSec=512 SecPerClust=8 ResSectors=1 FATs=2 RootDirEnts=512 Media=0xf0 FATsecs=64 SecPerTrack=17 Heads=255 HiddenSecs=0 HugeSectors=131053 Image Name: Created: Tue Aug 19 02:20:04 2014 Image Type: ARM Linux Script (uncompressed) Data Size: 55 Bytes = 0.05 kB = 0.00 MB Load Address: 00000000 Entry Point: 00000000 Contents: Image 0: 47 Bytes = 0.05 kB = 0.00 MB 23+1 records in 23+1 records out 24064 bytes transferred in 0.003972 secs (6058691 bytes/sec) 235+1 records in 235+1 records out 241544 bytes transferred in 0.003128 secs (77224557 bytes/sec)
Original Banana Pi U-boot loader output:
U-Boot SPL 2014.04-10704-gf625d1d (Aug 16 2014 - 23:44:23) Board: Bananapi DRAM: 1024 MiB CPU: 960000000Hz, AXI/AHB/APB: 3/2/2 spl: not an uImage at 1600 spl: not an uImage at 80 ### ERROR ### Please RESET the board ###
And Lemaker's:
U-Boot SPL 2014.04-10693-gf954935 (Aug 17 2014 - 21:41:27) Board: Bananapi DRAM: 1024 MiB CPU: 960000000Hz, AXI/AHB/APB: 3/2/2 spl: not an uImage at 1600 spl: not an uImage at 80 ### ERROR ### Please RESET the board ###
The only way it works is: # Cubieboard's 2 U-boot loader from FreeBSD Wiki dd if=sunxi-spl.bin conv=notrunc of=banana.img bs=1024 seek=8 dd if=u-boot.bin conv=notrunc of=banana.img bs=1024 seek=32
And according to https://github.com/linux-sunxi/u-boot-sunxi/wiki "If using v2013.07 or earlier then the procedure is slightly different dd if=spl/sunxi-spl.bin of=/dev/sdX bs=1024 seek=8 dd if=u-boot.bin of=/dev/sdX bs=1024 seek=32" but I'm using newer version.
I'm getting problems with addressing all available memory (0x40000000, size: 0x40000000 = 1024MB), I belive it's caused by Cubieboard's version of u-boot. The only way it works is 0x40000000 size 0x20000000 in kernel's memory addressing which is half of all available memory. So I have to use Cubieboard's 2 version of u-boot to start my board.
Hello,
currently memory controller paramaters are set from constants defined in u-boot at compile time. U-boots needs to configure the memory controller so it has some place to load the kernel binary.
If your memory configuration is incorrect you might have stability problems or may not be able to access all memory. There is a10-meminfo tool http://linux-sunxi.org/Retrieving_device_information#Reading_memory_informat... which you can run on the original Android or GNU/Linux installation (if any) to determine what memory parameters the manufacturer used and configure your u-boot accordingly. Note that cubieboard1 and cubieboard2 use a different SoC so u-boot compiled for one might not configure the other correctly. Especially the SMP on a20 works correctly only with recent u-boot. You should use u-boot compiled for your SoC a10/a20/...
Support for BananaPi is currently available in the u-boot-arm.git tree.
Ian.

W dniu 2014-08-21 22:31, Ian Campbell pisze:
Support for BananaPi is currently available in the u-boot-arm.git tree. Ian.
Thank You. I've downloaded u-boot-arm.git tree yesterday.
Started config menu as for usual kernel: root@freebsd:/usr/src/u-boot-arm # gmake -j4 ARCH=arm CROSS_COMPILE=arm-eabi- HOSTCC=cc USE_PRIVATE_LIBGCC=yes menuconfig
Then selected: - ARM architecture - Target select: support sun7i Not selected: - SPL (due compilation errors, see below)
Compilation: root@freebsd:/usr/src/u-boot-arm # gmake -j4 ARCH=arm CROSS_COMPILE=arm-eabi- HOSTCC=cc USE_PRIVATE_LIBGCC=yes
ERRORS: 1. with SPL enabled: HOSTLD scripts/kconfig/conf scripts/kconfig/conf --silentoldconfig Kconfig scripts/kconfig/conf --silentoldconfig Kconfig *** *** Configuration file "spl/.config" not found! *** *** Please run some configurator (e.g. "make oldconfig" or *** "make menuconfig" or "make xconfig"). *** gmake[2]: *** [silentoldconfig] Error 1 'gmake -f /usr/src/u-boot-arm/scripts/Makefile.build obj=scripts/kconfig silentoldconfig SRCARCH=.. KCONFIG_OBJDIR=spl KCONFIG_CONFIG=spl/.config' Failed gmake[1]: *** [silentoldconfig] Error 1 gmake: *** No rule to make target `include/config/auto.conf', needed by `include/config/uboot.release'. Stop.
2. without SPL: scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config.h GEN include/autoconf.mk GEN include/autoconf.mk.dep CHK include/config/uboot.release CHK include/generated/timestamp_autogenerated.h UPD include/generated/timestamp_autogenerated.h CHK include/generated/version_autogenerated.h CC lib/asm-offsets.s CC arch/arm/lib/asm-offsets.s GEN include/generated/generic-asm-offsets.h GEN include/generated/asm-offsets.h LDS u-boot.lds HOSTCC tools/dumpimage.o HOSTCC tools/image-host.o HOSTCC tools/mkenvimage.o HOSTCC tools/mkimage.o HOSTLD tools/mkenvimage HOSTLD tools/dumpimage HOSTLD tools/mkimage scripts/Makefile.build:55: /usr/src/u-boot-arm/board/amd/sunxi/Makefile: No such file or directory gmake[1]: *** No rule to make target `/usr/src/u-boot-arm/board/amd/sunxi/Makefile'. Stop. gmake: *** [board/amd/sunxi] Error 2 gmake: *** Waiting for unfinished jobs.... CC arch/arm/cpu/armv7/cache_v7.o CC arch/arm/cpu/armv7/cpu.o CC arch/arm/cpu/armv7/sunxi/timer.o AS arch/arm/lib/crt0.o CC arch/arm/cpu/armv7/syslib.o CC arch/arm/lib/bootm-fdt.o CC arch/arm/cpu/armv7/sunxi/board.o AS arch/arm/cpu/armv7/lowlevel_init.o AS arch/arm/cpu/armv7/nonsec_virt.o CC arch/arm/lib/bootm.o CC arch/arm/cpu/armv7/virt-v7.o CC arch/arm/cpu/armv7/virt-dt.o CC arch/arm/cpu/armv7/sunxi/clock.o AS arch/arm/cpu/armv7/psci.o CC arch/arm/cpu/armv7/sunxi/pinmux.o AS arch/arm/cpu/armv7/start.o LD arch/arm/cpu/armv7/built-in.o CC arch/arm/lib/interrupts.o CC arch/arm/cpu/armv7/sunxi/clock_sun4i.o CC arch/arm/cpu/armv7/sunxi/cpu_info.o AS arch/arm/cpu/armv7/sunxi/psci.o CC arch/arm/lib/reset.o LD arch/arm/cpu/armv7/sunxi/built-in.o CC arch/arm/lib/cache.o CC arch/arm/lib/cache-cp15.o CC arch/arm/lib/eabi_compat.o LD arch/arm/lib/built-in.o
Maybe not this way??
Cheers, TooMeeK

It also fails with: root@freebsd:/usr/src/u-boot-arm # gmake -j4 CROSS_COMPILE=arm-eabi- USE_PRIVATE_LIBGCC=yes Bananapi_defconfig root@freebsd:/usr/src/u-boot-arm # gmake -j4 CROSS_COMPILE=arm-eabi- USE_PRIVATE_LIBGCC=yes as README file says, with the same error:
scripts/Makefile.build:55: /usr/src/u-boot-arm/board/amd/sunxi/Makefile: No such file or directory gmake[1]: *** No rule to make target `/usr/src/u-boot-arm/board/amd/sunxi/Makefile'. Stop. gmake: *** [board/amd/sunxi] Error 2 gmake: *** Waiting for unfinished jobs.... AS arch/arm/cpu/armv7/start.o
I'm running FreeBSD 10.0 64-bit VM to build my images..
Best regards, TooMeeK

Hello again,
successfully compiled U-boot-arm.git source under bare-metal Linux on Banana Pi itself (not FreeBSD 64-bit VM). But still getting troubles at:
U-Boot SPL 2014.10-rc1 (Aug 26 2014 - 03:39:46) DRAM: 1024 MiB CPU: 960000000Hz, AXI/AHB/APB: 3/2/2
U-Boot 2014.10-rc1 (Aug 26 2014 - 03:39:46) Allwinner Technology
CPU: Allwinner A20 (SUN7I) I2C: ready DRAM: 1 GiB MMC: SUNXI SD/MMC: 0 *** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial SCSI: SUNXI SCSI INIT SATA link 0 timeout. AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode flags: ncq stag pm led clo only pmp pio slum part ccc apst Net: dwmac.1c50000 sun7i#
Yes, I know I should type here: fatload mmc 0 0x40200000 kernel; go 0x40200100 to load my FreeBSD 10.x kernel, however my serial console over J11 is read-only..
The only thing I don't uderstand why new loader ignores my boot.scr file? Tried FAT16, FAT32..
To be clear: #U-boot loader writing to image dd if=/root/banana/u-boot-arm_git/u-boot-sunxi-with-spl.bin conv=notrunc of=banana.img bs=1024 seek=8 #mkimage tools used from Lemaker's git echo "fatload mmc 0 0x40200000 kernel; go 0x40200100" > boot.cmd /usr/src/u-boot-bananapi/tools/mkimage -C none -A arm -T script -d boot.cmd boot.scr #but the same result for u-boot-arm.git tool
Best regards, TooMeeK
participants (3)
-
Ian Campbell
-
Michal Suchanek
-
TooMeeK Admin