On 16-Aug-17 12:52, Avelino Herrera Morales wrote:
Hi all, I am attempting to build the binutils/gcc/glibc toolchain to build a cross compiled Linux from scratch for my Raspberry Pi. I succesfully have compiled binutils, stage 1 of gcc and glibc: For binutils 2.29: $ configure --prefix=/opt/rpi --disable.nls --target=arm-linux-gnueabihf --disable-multilib $ make $ make install For gcc 7.2.0 (stage 1): $ export PATH=/opt/rpi/bin:${PATH} $ configure --prefix=/opt/rpi --target=arm-linux-gnueabihf --enable-languages=c --without-headers --disable-nls --disable-multilib --disable-threads --disable-shared $ make all-gcc all-target-libgcc $ make install-gcc install-target-libgcc Get current kernel headers: $ cd /opt/rpi/src $ git clone https://github.com/raspberrypi/linux.git $ cd linux $ make headers_install ARCH=arm INSTALL_HDR_PATH=/opt/rpi/src/kernel-headers
Don't do that that way. Install the kernel headers in in sysroot like this: /opt/rpi/sysroot
For glibc 2.26: $ configure --prefix=/opt/rpi --host=arm-linux-gnueabihf --with-headers=/opt/rpi/src/kernel-headers/include --disable-multilib $ make $ make install
Use --prefix=/usr and --with-headers=/opt/rpi/sysroot. Then use make install DESTDIR="/opt/rpi/sysroot"
Until here all is ok, but I am a bit confused about how to compile stage 2 of gcc. I have tested some configurations (found all over the internet) but no one compiles ok the stage 2. Any idea for how to compile the stage 2? I guess I should use the "--with-sysroot" configuration option but I don't understand it.
IIRC --with-sysroot=/opt/rpi/sysroot should be used on both stage2 of gcc and binutils.
-- chs