Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Crossdev For Arm v7 With Multiple GCC Versions? [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
fredbear5150
Tux's lil' helper
Tux's lil' helper


Joined: 11 Oct 2003
Posts: 113

PostPosted: Tue Jul 31, 2018 3:53 pm    Post subject: Crossdev For Arm v7 With Multiple GCC Versions? [SOLVED] Reply with quote

After months of procrastinating about it, I've decided to jump right in and build distcc with crossdev in order to try to teach myself how to make Gentoo builds on several SBCs including the Banana Pi and Orange Pi. I am still in the process of following various Wiki pages and online docs, distcc works fine within my existing amd64 architecture.

I've built an armv7 cross toolchain using the following command, it completed successfully:

Code:
 crossdev -S -P -v EXTRA_ECONF="-march=armv7-a -mfpu=neon-vfpv4 -ffast-math" -t armv7a-hardfloat-linux-gnueabi


I then run configure and try to compile the bootloader, and I get the error below:

Code:
haedus /mnt/bananapi-build/lemaker/u-boot-sunxi # make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- BananaPi_config
Configuring for BananaPi - Board: sun7i, Options: BANANAPI,SPL,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),STATUSLED=248,FAST_MBUS
haedus /mnt/bananapi-build/lemaker/u-boot-sunxi # make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi-
  GEN     include/autoconf.mk.dep
In file included from include/linux/compiler.h:40:0,
                 from include/part_efi.h:16,
                 from include/part.h:177,
                 from /mnt/bananapi-build/lemaker/u-boot-sunxi/include/common.h:92:
include/linux/compiler-gcc.h:93:1: fatal error: linux/compiler-gcc7.h: No such file or directory
 #include gcc_header(__GNUC__)
 ^~~~
compilation terminated.
  GEN     include/autoconf.mk.dep
In file included from include/linux/compiler.h:40:0,
                 from include/part_efi.h:16,
                 from include/part.h:177,
                 from /mnt/bananapi-build/lemaker/u-boot-sunxi/include/common.h:92:
include/linux/compiler-gcc.h:93:1: fatal error: linux/compiler-gcc7.h: No such file or directory
 #include gcc_header(__GNUC__)
 ^~~~
compilation terminated.
  GEN     include/autoconf.mk
In file included from include/linux/compiler.h:40:0,
                 from include/part_efi.h:16,
                 from include/part.h:177,
                 from /mnt/bananapi-build/lemaker/u-boot-sunxi/include/common.h:92:
include/linux/compiler-gcc.h:93:1: fatal error: linux/compiler-gcc7.h: No such file or directory
 #include gcc_header(__GNUC__)
 ^~~~
compilation terminated.
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CC      lib/asm-offsets.s
In file included from include/linux/compiler.h:40:0,
                 from include/part_efi.h:16,
                 from include/part.h:177,
                 from include/common.h:92,
                 from lib/asm-offsets.c:15:
include/linux/compiler-gcc.h:93:1: fatal error: linux/compiler-gcc7.h: No such file or directory
 #include gcc_header(__GNUC__)
 ^~~~
compilation terminated.
make[1]: *** [/mnt/bananapi-build/lemaker/u-boot-sunxi/./Kbuild:35: lib/asm-offsets.s] Error 1
make: *** [Makefile:1006: prepare0] Error 2


I then discover that gcc7 isn't supported for this Banana Pi code, only gcc6. Here's my gcc-config:

Code:
haedus /mnt/bananapi-build/lemaker/u-boot-sunxi # gcc-config -l
 [1] aarch64-unknown-linux-gnu-7.3.0 *

 [2] armv7a-hardfloat-linux-gnueabi-7.3.0 *

 [3] x86_64-pc-linux-gnu-7.3.0 *


This is the part I cannot find any information on - can I install gcc6 within crossdev and then just use gcc-config to change to that compiler version? And how does that affect the operation of distcc? Does the same gcc version have to be available on all the distcc boxes?


Last edited by fredbear5150 on Sat Aug 04, 2018 7:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
NReale3370
n00b
n00b


Joined: 26 Jul 2013
Posts: 17

PostPosted: Tue Jul 31, 2018 11:47 pm    Post subject: Reply with quote

I have a Banana Pi myself with Gentoo on it, and it looks like you're using lemaker's u-boot. You can actually compile the mainline u-boot which should work with your crossdev gcc7 and all (I compiled it myself a few of months ago)
Back to top
View user's profile Send private message
fredbear5150
Tux's lil' helper
Tux's lil' helper


Joined: 11 Oct 2003
Posts: 113

PostPosted: Wed Aug 01, 2018 5:34 am    Post subject: Reply with quote

NReale3370 wrote:
I have a Banana Pi myself with Gentoo on it, and it looks like you're using lemaker's u-boot. You can actually compile the mainline u-boot which should work with your crossdev gcc7 and all (I compiled it myself a few of months ago)


Yes, I think I have figured it out having played some more last night with it. I managed to get a latest kernel and u-boot to compile, all I had to do for u-boot was temporarily revert the Python interpeter to 2.7 on my system with "eselect python set x" because of a particular Python module that was needed.

I've got several non-Raspberry Pi SBCs that include the Banana Pi M1, Orange Pi PC Plus and Orange Pi Plus 2E (plus a couple of other obscure ones) that I've been planning to put Gentoo on for some time, I think I might end up writing updated installation instructions and maybe a YouTube video or two as everything I've used up to this point is a bit of date.

I'm particularly interested in following the progress of the open source Arm Mali kernel drivers as those have started to be included in the 4.18 kernel.

I will do a build over the next couple of days and publish a summary of what I did here for others to use - then maybe expand it into a Wiki page and video or two.

But thanks for the guidance anyway! :D
Back to top
View user's profile Send private message
fredbear5150
Tux's lil' helper
Tux's lil' helper


Joined: 11 Oct 2003
Posts: 113

PostPosted: Wed Aug 01, 2018 1:25 pm    Post subject: Reply with quote

NReale3370 wrote:
I have a Banana Pi myself with Gentoo on it, and it looks like you're using lemaker's u-boot. You can actually compile the mainline u-boot which should work with your crossdev gcc7 and all (I compiled it myself a few of months ago)


Can I ask what kernel sources you used for your build?

I got everything to compile correctly using the mainline kernel sources but I've not been able to get the Banana Pi to boot with them - I have a feeling it's something to do with the way the device tree blob (.dtb) is used within the u-boot configuration.

I was going to step back to the 3.4 sunxi kernel sources and try and bring Gentoo up on that first, as the documentation seems clearer.

I also booted the Banana Pi up on a Debian 4.0 build just to check there's no problem from a hardware perspective, which there isn't - it booted Debian fine.
Back to top
View user's profile Send private message
NReale3370
n00b
n00b


Joined: 26 Jul 2013
Posts: 17

PostPosted: Wed Aug 01, 2018 2:24 pm    Post subject: Reply with quote

I'm using Gentoo sources unstable 4.17.11, cross compiled on my desktop. My banana pi isn't the M1 so I'm using the sun7i-a20-bananapi.dtb dtb file. The only thing I've never gotten to work on my own kernel that works on the archlinuxarm kernel (the only other I've tried) is rebooting via command line, the system seems to hang at the end but that doesn't really bother me.
Back to top
View user's profile Send private message
fredbear5150
Tux's lil' helper
Tux's lil' helper


Joined: 11 Oct 2003
Posts: 113

PostPosted: Wed Aug 01, 2018 2:52 pm    Post subject: Reply with quote

So do you use it for video playback, emulation or other stuff where the video acceleration is important? Are you using the in-kernel Mali drivers or just framebuffer?

I really don't want to go back to a 3.4 kernel with binary blobs, I'd much rather go with 4.x, even if the kernel Mali drivers only have partial functionality.
Back to top
View user's profile Send private message
NReale3370
n00b
n00b


Joined: 26 Jul 2013
Posts: 17

PostPosted: Wed Aug 01, 2018 2:56 pm    Post subject: Reply with quote

Headless media and print/scan server. Never used the Mali drivers, just used the framebuffer on rare occasion to debug problems when ssh went down. I use miniDLNA to stream video from an esata connected hard drive. I can post/send my config here, its a static kernel stripped to what I think is the bear minimum of what the banana pi needs to run.
Back to top
View user's profile Send private message
fredbear5150
Tux's lil' helper
Tux's lil' helper


Joined: 11 Oct 2003
Posts: 113

PostPosted: Wed Aug 01, 2018 3:16 pm    Post subject: Reply with quote

Your kernel config would be extremely useful - also the contents of your boot.cmd file in /boot.
Back to top
View user's profile Send private message
NReale3370
n00b
n00b


Joined: 26 Jul 2013
Posts: 17

PostPosted: Wed Aug 01, 2018 3:30 pm    Post subject: Reply with quote

Kernel config:
https://pastebin.com/iDnkv4Mz

boot.cmd:
Code:

setenv bootargs root=/dev/mmcblk0p1 rootfstype=ext4 rootwait sunxi_ve_mem_reserve=0 sunxi_g2d_mem_reserve=0 sunxi_no_mali_mem_reserve
load mmc 0:1 0x43000000 /boot/dtbs/sun7i-a20-bananapi.dtb
load mmc 0:1 0x42000000 /boot/zImage
bootz 0x42000000 - 0x43000000
Back to top
View user's profile Send private message
fredbear5150
Tux's lil' helper
Tux's lil' helper


Joined: 11 Oct 2003
Posts: 113

PostPosted: Wed Aug 01, 2018 4:19 pm    Post subject: Reply with quote

Thanks for both of these, I will give it another try.
Back to top
View user's profile Send private message
fredbear5150
Tux's lil' helper
Tux's lil' helper


Joined: 11 Oct 2003
Posts: 113

PostPosted: Sat Aug 04, 2018 7:20 pm    Post subject: Reply with quote

NReale3370,

Thank you for your assistance, I managed to get there in the end and now have a Banana Pi M1 that boots Gentoo and the mainline kernel.

I had originally tried to get it to work using a small FAT32 boot partition and a big EXT4 partition. I did manage to get it to boot once with a virgin kernel config (from the sunxi site), I then tried your config and it then wouldn't boot. And I couldn't get it to boot.

I then noticed your config and put everything on one EXT4 partition (I wasn't aware Banana Pi could boot from EXT4) and it worked first time.

So now I am learning all about Gentoo on ARM! :P
Back to top
View user's profile Send private message
NReale3370
n00b
n00b


Joined: 26 Jul 2013
Posts: 17

PostPosted: Sat Aug 04, 2018 8:02 pm    Post subject: Reply with quote

As I understand it the file system is irrelevant from a hardware standpoint. the Pi looks for u-boot at a fixed position on the SD card (hence writing it with dd), and then u-boot handles the rest. Newer versions of u-boot are extremely flexible in what they boot, supporting lots of filesystems I have done a separate boot partition in the past but you have to update your root= value to the right partition and make sure you're parsing the folders right, really just an aggravation. How are you compiling packages for the Gentoo now? I was using qemu-user and systemd-nspawn to compile right on the sd card using my desktop, but its so dog slow I've recently tried to get distccd to do it, which works ok for most packages. Compiling GCC seems to take an eternity no matter how I do it (3 hours for 7.3.0 using qemu)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54615
Location: 56N 3W

PostPosted: Sat Aug 04, 2018 9:07 pm    Post subject: Reply with quote

NReale3370,

gcc builds itself three times and cannot use distcc.

The first build uses any random compiler on the system to build enough of gcc to build itself. That might distribute.
The second build uses the gcc just built to build itself again. That can't distribute as there is only one instance of the gcc to do the building
Next, uses this second build to build itself again. These two builds should be identical. After that has been checked, the other languages are built.

When gcc is cross compiled the first two stages are skipped.

When you use qemu-user for building you can run a distcc helper on the same host too.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
NReale3370
n00b
n00b


Joined: 26 Jul 2013
Posts: 17

PostPosted: Sun Aug 05, 2018 12:36 am    Post subject: Reply with quote

Yeah that's what I've been doing and it does seem to use distcc for the first part and speeds up a number of my other packages (kernel builds in qemu were awful slow and I do those entirely in cross now). I was just wondering how someone else handles the long compile time and if I was missing something.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54615
Location: 56N 3W

PostPosted: Sun Aug 05, 2018 7:53 am    Post subject: Reply with quote

NReale3370,

You can cross compile gcc but its not easy. I've not done it for armv7a ...
Choose your USE flags carefully.
You get a binary package of gcc that you install with
Code:
emerge -K ...


Cross compiling the kernel just works as its the only way to get a kernel for a new arch. There is no point in building the kernel on the arm board.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
fredbear5150
Tux's lil' helper
Tux's lil' helper


Joined: 11 Oct 2003
Posts: 113

PostPosted: Sun Aug 05, 2018 8:58 am    Post subject: Reply with quote

Quote:
How are you compiling packages for the Gentoo now?


That's my next objective, bearing in mind that Gentoo on ARM is a completely new thing to me.

I'm first going down the distcc path, to see how well that works. distcc isn't in the ARM Stage 3 builds that I can find, I'm currently compiling it on the Banana Pi and then I will set it up to work with one of the desktop machines.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54615
Location: 56N 3W

PostPosted: Sun Aug 05, 2018 11:01 am    Post subject: Reply with quote

fredbear5150,

The stage3 is only must have stuff, so distcc is not there by design.
distcc is the 'least worst' way of building for weaker hardware.

Do check that you have *identical* versions of gcc active on your Banana Pi and all the helpers.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum