# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focal
# uname -r 5.4.0-216-generic
# ldd --version ldd (Ubuntu GLIBC 2.31-0ubuntu9.18) 2.31 Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the sourcefor copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Roland McGrath and Ulrich Drepper.
cd /opt tar xf binutils-2.44.tar.xz cd binutils-2.44/ mkdir build && cd build ../configure --prefix=$PREFIX --disable-nls --disable-multilib --build=$BUILD --host=$HOST --target=$TARGET make -j$(nproc) make install-strip
安装 Linux 内核头文件
1 2 3 4
cd /opt tar xf linux-5.4.tar.xz cd linux-5.4/ make ARCH=arm64 headers_install INSTALL_HDR_PATH=$SYSROOT
头文件会安装到$SYSROOT/include下。
编译 glibc
1 2 3 4 5 6 7
cd /opt tar xf glibc-2.31.tar.xz cd glibc-2.31/ mkdir build && cd build ../configure --prefix=$SYSROOT --with-headers=$SYSROOT/include --disable-multilib --disable-werror --build=$BUILD --host=$TARGET make -j$(nproc) make install
/* GNU ld script Use the shared library, but some functions are only in the static library, so try that secondarily. */ OUTPUT_FORMAT(elf64-littleaarch64) GROUP ( /opt/cross/aarch64-linux-gnu/lib/libc.so.6 /opt/cross/aarch64-linux-gnu/lib/libc_nonshared.a AS_NEEDED ( /opt/cross/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 ) )