본문 바로가기
Cross Linux From Scratch

CLFS

by 코딩스미스 2023. 3. 11.
export CLFS_TARGET=arm-linux-gnueabi
export CLFS_HOST=aarch64-cross-linux-gnu

# binutils
../configure \
	--prefix=/cross-tools \
    --target=arm-linux-gnueabi \
    --with-sysroot=${CLFS} \
    --with-arch=armv7l \
    --with-float=soft \
    --disable-nls \
    --enable-gprofng=no \
    --disable-werror
make -j4 
make install

# Install the Linux kernel headers
make ARCH=arm INSTALL_HDR_PATH=/cross-tools/arm-linux-gnueabi headers_install

# Build gcc (first phase)
../configure \
	--prefix=/cross-tools \
    --target=arm-linux-gnueabi \
    --prefix=/cross-tools \
    --build=${CLFS_HOST} \
    --host=${CLFS_HOST} \
    --with-sysroot=${CLFS} \
    --enable-languages=c,c++ \
    --with-glibc-version=2.37 \
    --with-arch=armv7 \
    --with-float=soft \
    --with-newlib             \
    --without-headers         \
    --enable-default-pie      \
    --enable-default-ssp      \
    --disable-nls             \
    --disable-shared          \
    --disable-multilib        \
    --disable-threads         \
    --disable-libatomic       \
    --disable-libgomp         \
    --disable-libquadmath     \
    --disable-libssp          \
    --disable-libvtv          \
    --disable-libstdcxx       \
    --disable-werror
make -j4 all-gcc
make install-gcc

# glibc
BUILD_CC="gcc" \
CC="${CLFS_TARGET}-gcc" \
AR="${CLFS_TARGET}-ar" \
RANLIB="${CLFS_TARGET}-ranlib" \
ASFLAGS="-mcpu=cortex-m3 -mthumb -mno-thumb-interwork -mfpu=vfp -msoft-float -mfix-cortex-m3-ldrd" \
../configure \
    --prefix=/tools \
    --host=${CLFS_TARGET} \
    --build=${CLFS_HOST} \
    --enable-kernel=3.2 \
    --with-binutils=/cross-tools/bin \
    --with-headers=/tools/include \
    --enable-obsolete-rpc
    
make install-bootstrap-headers=yes install-headers

export CLFS=/mnt/clfs

moutn -v -t ext4 /dev/<xxx> $CLFS

 

https://blog.jgosmann.de/posts/2021/02/07/a-guide-to-crosscompiling-applications/

 

A guide to cross-compiling applications | Jan's blog

A guide to cross-compiling applications  February 7, 2021 13 minute read

blog.jgosmann.de

https://wiki.osdev.org/GCC_Cross-Compiler

 

GCC Cross-Compiler - OSDev Wiki

This page or section refers to its readers or editors using I, my, we or us. It should be edited to be in an encyclopedic tone. This tutorial focuses on creating a GCC cross-compiler for your own operating system. This compiler that we build here will have

wiki.osdev.org

https://gist.github.com/rikka0w0/612149263721050f69acdc0497bf9fb8

 

Build gcc cross-compiler for armv7l (arm-linux-gnueabi)

Build gcc cross-compiler for armv7l (arm-linux-gnueabi) - buildcrossgcc.sh

gist.github.com