U-Boot 2014.04-10734-g41cf48d-dirty (Dec 07 2016 - 12:36:03) Allwinner TechnologyFirst, a package or two need to be installed. I already have a lot of things installed for other reasons, so you may need more packages than this on your setup. On my fedora 24 system I do the following. This also pulls in a package called "dtc".
su dnf install uboot-tools dnf install libusb-develI actually mised the libusb-devel package the first time around and got this error:
No package 'libusb-1.0' found fel.c:22:20: fatal error: libusb.h: No such file or directory #includeThen I dove in to build the entire BSP (it turns out there are individual instructions for just building u-boot, but no harm done. Then this:
git clone https://github.com/orangepi-xunlong/orangepi-bsp.git cd orangepi-bsp #./configure OrangePi ./configure orangepiThe instructions let me down a bit here, but specifying "orangepi" rather than "OrangePi" at least seems to let me do the configure without errors. The "make" clones something, then finds the compiler missing. The "configure" script is not the usual 5000 line monster, it is only 80 lines, just typing "./configure" gives a list of boards, which include:
* orangepi orangepi-android * orangepimini orangepimini-androidSo, after this I type "make".
make git submodule init git submodule update u-boot-sunxi Cloning into 'u-boot-sunxi'... remote: Counting objects: 316694, done. remote: Compressing objects: 100% (3/3), done. remote: Total 316694 (delta 0), reused 0 (delta 0), pack-reused 316691 Receiving objects: 100% (316694/316694), 84.87 MiB | 3.33 MiB/s, done. Resolving deltas: 100% (246420/246420), done. Checking connectivity... done. Submodule path 'u-boot-sunxi': checked out '41cf48dffa7f5df052c1918cdc03d4fb6927ab33' mkdir -p /u1/Projects/Orange_pi/orangepi-bsp/build/orangepi-u-boot make -C u-boot-sunxi orangepi_config O=/u1/Projects/Orange_pi/orangepi-bsp/build/orangepi-u-boot CROSS_COMPILE=arm-linux-gnueabihf- -j16 arm-linux-gnueabihf-gcc: command not found
So, what the heck is the "hf"? Apparently it indicates that the compiler is set up to produce code that uses Hardware Floating point. The hot tip for doing this on Fedora is the following (and indeed I have arm-linux-gnu-gcc already).
CROSS_COMPILE=CROSS_COMPILE=arm-linux-gnu-This is a one-line change in the Makefile and away we go again. Now we get this error:
/u1/Projects/Orange_pi/orangepi-bsp/u-boot-sunxi/include/linux/compiler-gcc.h:93:30: fatal error: linux/compiler-gcc6.h: No such file or directory arm-linux-gnu-gcc --version arm-linux-gnu-gcc (GCC) 6.1.1 20160621 (Red Hat Cross 6.1.1-2)I have seen this before. The problem is a compatibility issue between old linux sources and the current gcc (gcc 6). You may be saying, "this is u-boot, not the linux kernel". Yes indeed, but if you have studied u-boot you know that is borrows heavily from the linux kernel. And in fact the issue is in "include/linux", which are a snapshot of the linux include files from some (to me unknown) old version of the linux kernel. Recent linux kernels have this all straight and work fine with the lastest gcc. In fact the new kernel headers cleaned up a bit of a mess in this particular area. Here are my notes from the last time. So, the deal is that these u-boot sources have a "snapshot" of some old set of linux header files that are incompatible with the current gcc. This is exactly the situation that I used to have with Kyu. The remedy (playing fast and loose until such time as the u-boot sources are made to build cleanly with gcc 6) is as follows:
cd orangepi-bsp/u-boot-sunxi/include/linux mkdir compiler-gcc_OLD mv compiler-gcc*.h compiler-gcc_OLD cp /usr/src/kernels/4.8.10-200.fc24.x86_64+debug/include/linux/compiler-gcc.h .This patches up whatever old linux header file snapshot is bundled with u-boot. Now we can move along to our next issue:
/u1/Projects/Orange_pi/orangepi-bsp/u-boot-sunxi/common/board_f.c:82:6: error: ‘coloured_LED_init’ aliased to external symbol ‘__coloured_LED_init’ void coloured_LED_init(void) ^~~~~~~~~~~~~~~~~ /u1/Projects/Orange_pi/orangepi-bsp/u-boot-sunxi/common/main.c:31:6: error: ‘show_boot_progress’ aliased to external symbol ‘__show_boot_progress’ void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress"))); ^~~~~~~~~~~~~~~~~~In addition to these errors, we see a bunch of these errors:
arch/arm/cpu/armv7/sunxi/board.o: In function `__raw_writesb': /u1/Projects/Orange_pi/orangepi-bsp/u-boot-sunxi/arch/arm/include/asm/io.h:80: multiple definition of `__raw_writesb' arch/arm/cpu/armv7/sunxi/timer.o:/u1/Projects/Orange_pi/orangepi-bsp/u-boot-sunxi/arch/arm/include/asm/io.h:80: first defined hereLet's look at __raw_writesb first. It is defined in arch/arm/include/asm/io.h as "extern inline void __raw_writesb", but where is the other definition coming from? There is nothing of the sort in /usr/include, so it is not from the local linux headers (and we would expect and hope that u-boot builds in its own self-contained environment).
there was a patch for this (back in August, 2015) that modifies (of all things) compiler-gcc.h (this is the file u-boot-sunxi/include/linux/compiler-gcc.h)
I basically hand edited this into compiler-gcc.h and after doing this, u-boot builds just fine.The build process goes on to build other things, and ultimately fails for some reason trying to clone the kernel sources (linux-sunxi.git).
mkdir -p /u1/Projects/Orange_pi/orangepi-bsp/output [ ! -s boot.cmd ] || mkimage -A arm -O u-boot -T script -C none -n "boot" -d boot.cmd /u1/Projects/Orange_pi/orangepi-bsp/build/boot.scr make -C sunxi-tools make[1]: Entering directory '/u1/Projects/Orange_pi/orangepi-bsp/sunxi-tools' gcc -g -O0 -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/ `pkg-config --cflags libusb-1.0` -o fel fel.c `pkg-config --libs libusb-1.0` In file included from /usr/include/stdint.h:25:0, from /usr/lib/gcc/x86_64-redhat-linux/6.2.1/include/stdint.h:9, from /usr/include/libusb-1.0/libusb.h:50, from fel.c:22: /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp] # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" ^~~~~~~ gcc -g -O0 -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/ -o pio pio.c In file included from /usr/include/errno.h:28:0, from pio.c:23: /usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp] # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" ^~~~~~~ pio.c: In function ‘do_command’: pio.c:316:57: warning: unused parameter ‘argc’ [-Wunused-parameter] static int do_command(char *buf, const char **args, int argc) ^~~~ gcc -g -O0 -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/ -c -o nand-part-main.o nand-part-main.c gcc -g -O0 -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/ -c -o nand-part-a10.o nand-part.c -D A10 gcc -g -O0 -Wall -Wextra -std=c99 -D_POSIX_C_SOURCE=200112L -Iinclude/ -c -o nand-part-a20.o nand-part.c -D A20 gcc -o nand-part nand-part-main.o nand-part-a10.o nand-part-a20.o make[1]: Leaving directory '/u1/Projects/Orange_pi/orangepi-bsp/sunxi-tools' mkdir -p /u1/Projects/Orange_pi/orangepi-bsp/output sunxi-tools/fex2bin sunxi-boards/sys_config/a20/orangepi.fex > /u1/Projects/Orange_pi/orangepi-bsp/build/orangepi.bin git submodule init git submodule update linux-sunxi Cloning into 'linux-sunxi'... remote: Counting objects: 4237563, done. remote: Compressing objects: 100% (151/151), done. error: RPC failed; curl 56 TCP connection reset by peer.33 MiB/s fatal: clone of 'https://github.com/orangepi-xunlong/linux-sunxi.git' into submodule path 'linux-sunxi' failed
Tom's electronics pages / tom@mmto.org