Next revision | Previous revision |
howtos:hardware:arm:gcc-13.x_aarch64_cross-compiler [2023/10/15 15:57 (UTC)] – created exaga | howtos:hardware:arm:gcc-13.x_aarch64_cross-compiler [2024/02/08 08:04 (UTC)] (current) – [AArch64 cross-compiler script code] changed -j4 to -j$(nproc) exaga |
---|
<!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> | <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> |
====== Slackware ARM current ARMv8 AArch64 cross-compiler build script (gcc-13.2.0) for the Raspberry Pi 3/4 ====== | ====== Slackware ARM 15.0 ARMv8 AArch64 cross-compiler build script (gcc-13.2.0) for the Raspberry Pi 3/4/5 ====== |
| |
===== Preface ===== | ===== Preface ===== |
| |
With the updates of [[http://arm.slackware.com|Slackware AArch64]] to gcc-13.2.0, this is an ARMv8 AArch64 cross-compiler bash script that's intended for building binaries from source code and turning them into Slackware packages on 32-bit slackware systems. Or whatever other purpose(s) you may find for this script and its possibilities. | With the updates of [[http://arm.slackware.com|Slackware AArch64]] to gcc-13.2.0, this is an ARMv8 AArch64 cross-compiler bash script that's intended for building binaries from source code and turning them into Slackware packages on 32-bit Slackware systems. Or whatever other purpose(s) you may find for this script and its possibilities. |
| |
Previous [[https://docs.slackware.com/howtos:hardware:arm:gcc-12.x_aarch64_cross-compiler|work in this area]] has been done over the years but the build script and intructions are mostly the same. Some of the code in the script has changed from the previous version(s), with updated binutils and glibc versions, and especially the libsanitizer/asan source code patching. | Previous [[https://docs.slackware.com/howtos:hardware:arm:gcc-12.x_aarch64_cross-compiler|work in this area]] has been done over the years but the build script and instructions are mostly the same. Some of the code in the script has changed from the previous version(s), with notable and updated binutils and glibc versions, and especially the libsanitizer/asan patch code. |
| |
===== Notes ===== | ===== Notes ===== |
| |
Slackware ARM 15.0 was used on a Raspberry Pi 2 [2GB RAM] to build and install the gcc-13.2.0 aarch64-linux cross-compiler. | Slackware ARM 15.0 was used on a Raspberry Pi 3 [1GB RAM] to build and install the gcc-13.2.0 aarch64-linux cross-compiler. |
| |
The Linux kernel source downloaded is from the Raspberry Pi Github repository: [[https://github.com/raspberrypi/linux]] | The Linux kernel source downloaded is from the Raspberry Pi Github repository: [[https://github.com/raspberrypi/linux]] |
| |
As a pre-requisite, you should have; | As a pre-requisite, you should have; |
* a Raspberry Pi 3, 4, 5, (i.e. a 64-bit CPU) running Slackware ARM current with as much unused [>= 5GB] storage space on your system as possible. \\ | * a Raspberry Pi 3, 4, 5, (i.e. a 64-bit CPU) running Slackware ARM 15.0 with as much unused [>= 5GB] storage space on your system as possible. \\ |
* [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/a/|gawk]], [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/|git]], [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/|bison]] and [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/|flex]], already installed on your system. \\ | * [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-15.0/slackware/a/|gawk]], [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-15.0/slackware/d/|git]], [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-15.0/slackware/d/|bison]] and [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-15.0/slackware/d/|flex]], already installed on your system. \\ |
| |
| |
| |
############################################################################## | ############################################################################## |
# Slackware ARM gcc-13.2.0 aarch64 cross-compiler for Raspberry Pi | |
# | # |
# SARPi64.SlackBuild-gcc-13.2.0-aarch64-cc [v1.6] - 2022-09-17 | # Slackware ARM gcc-13.2.0 AArch64 cross-compiler for Raspberry Pi |
| # |
| # SARPi64.SlackBuild-gcc-13.2.0-aarch64-cc [v1.6] - 2023-10-14 |
# | # |
# 2023-10-14 by Exaga - v1.6 - gcc-13.2.x | # 2023-10-14 by Exaga - v1.6 - gcc-13.2.x |
# This script downloads RPi Linux kernel source and the required binaries, | # This script downloads RPi Linux kernel source and the required binaries, |
# and configures, builds, patches, and installs a gcc 13.2.x aarch64-linux | # and configures, builds, patches, and installs a gcc 13.2.x aarch64-linux |
# cross-compiler on Slackware ARM current running on a Raspberry Pi 3/4. | # cross-compiler on Slackware ARM running on a Raspberry Pi 3/4/5. |
# | # |
### Installation & Usage ### | ### Installation & Usage ### |
| # |
# You should create a 'build-dir' folder and copy this script to it | # You should create a 'build-dir' folder and copy this script to it |
# (e.g. /tmp/build-dir) and run it from there as a 'root' user. | # (e.g. /tmp/build-dir) and run it from there as a 'root' user. |
# | # |
# ~# chmod +x SARPi64.SlackBuild-gcc-13.2.0-aarch64-cc.sh | |
# ~# ./SARPi64.SlackBuild-gcc-13.2.0-aarch64-cc.sh | # ~# ./SARPi64.SlackBuild-gcc-13.2.0-aarch64-cc.sh |
# | # |
# | # |
# If you need to install any of the packages above [* check for updates!]: | # If you need to install any of the packages above [* check for updates!]: |
# http://slackware.uk/slackwarearm/slackwarearm-current/slackware/a/gawk*.txz | # http://slackware.uk/slackwarearm/slackwarearm-15.0/slackware/a/gawk*.txz |
# http://slackware.uk/slackwarearm/slackwarearm-current/slackware/d/git*.txz | # http://slackware.uk/slackwarearm/slackwarearm-15.0/slackware/d/git*.txz |
# http://slackware.uk/slackwarearm/slackwarearm-current/slackware/d/bison*.txz | # http://slackware.uk/slackwarearm/slackwarearm-15.0/slackware/d/bison*.txz |
# http://slackware.uk/slackwarearm/slackwarearm-current/slackware/d/flex*.txz | # http://slackware.uk/slackwarearm/slackwarearm-15.0/slackware/d/flex*.txz |
# | # |
# NB: The gcc package you compile should match your currently installed gcc | # NB: The gcc package you compile should match your currently installed gcc |
# | # |
# ~# gcc --version | # ~# gcc --version |
| # |
| # Copy the Linux kernel-headers package to /tmp/usr and delete asm directory. |
| # Then symlink it to asm-armv8 directory: |
| # |
| # root@jook:/tmp/usr/include# rm -rf asm |
| # root@jook:/tmp/usr/include# ln -sf asm-armv8 asm |
# | # |
# More recent gcc packages-versions may exist. You may wish to install them. | # More recent gcc packages-versions may exist. You may wish to install them. |
# | # |
# binutils - https://ftp.gnu.org/gnu/binutils/ | # binutils - https://ftp.gnu.org/gnu/binutils/ |
# cloog -https://gcc.gnu.org/pub/gcc/infrastructure/ | # cloog - ftp://gcc.gnu.org/pub/gcc/infrastructure/ |
# gcc - https://ftp.gnu.org/gnu/gcc/ | # gcc - https://ftp.gnu.org/gnu/gcc/ |
# glibc - https://ftp.gnu.org/gnu/glibc/ | # glibc - https://ftp.gnu.org/gnu/glibc/ |
# gmp - https://ftp.gnu.org/gnu/gmp/ | # gmp - https://ftp.gnu.org/gnu/gmp/ |
# isl - https://gcc.gnu.org/pub/gcc/infrastructure/ | # isl - ftp://gcc.gnu.org/pub/gcc/infrastructure/ |
# mpfr - https://ftp.gnu.org/gnu/mpfr/ | # mpfr - https://ftp.gnu.org/gnu/mpfr/ |
# mpc - https://ftp.gnu.org/gnu/mpc/ | # mpc - https://ftp.gnu.org/gnu/mpc/ |
# | # |
### Disclaimer ### | ### Disclaimer ### |
| # |
# This script was created on Slackware ARM and intended for development | # This script was created on Slackware ARM and intended for development |
# and testing on Slackware AArch64. This script may work on other Linux | # and testing on Slackware AArch64. This script may work on other Linux |
# Slackware AArch64. | # Slackware AArch64. |
# | # |
# Copyright 2016-2022 Exaga, sarpi.penthux.net | # Copyright (c) 2016-2024 Exaga - sarpi.penthux.net |
# All rights reserved. | |
# | # |
# Permission to use, copy, modify, and distribute this software for | # Permission to use, copy, modify, and distribute this software for |
# any purpose with or without fee is hereby granted, provided that | # any purpose with or without fee is hereby granted, provided that |
# the above copyright notice and this permission notice appear in all | # the above copyright notice and this disclaimer notice appear in |
# copies. | # all copies. All rights reserved. |
# | # |
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
############################################################################## | ############################################################################## |
| |
| |
############################################################################# | |
## SETTINGS AND VERSIONS ## | |
############################################################################# | |
| |
# Installation directory - edit INSTALL_PATH as required | # Installation directory - edit INSTALL_PATH as required |
INSTALL_PATH=/tmp/.gcc-cross | INSTALL_PATH=/tmp/.gcc-cross |
| |
# Required build packages versions [* newer versions may exist] | # Required build packages-versions [* newer versions may exist] |
BINUTILS_VERSION=binutils-2.41 | BINUTILS_VERSION=binutils-2.41 |
CLOOG_VERSION=cloog-0.18.1 | CLOOG_VERSION=cloog-0.18.1 |
GCC_VERSION=gcc-13.2.0 | GCC_VERSION=gcc-13.2.0 |
GLIBC_VERSION=glibc-2.38 | GLIBC_VERSION=glibc-2.38 |
GMP_VERSION=gmp-6.3.0 | GMP_VERSION=gmp-6.2.1 |
ISL_VERSION=isl-0.24 | ISL_VERSION=isl-0.24 |
MPFR_VERSION=mpfr-4.2.1 | MPFR_VERSION=mpfr-4.1.0 |
MPC_VERSION=mpc-1.3.1 | MPC_VERSION=mpc-1.2.1 |
| |
# RPi GitHub Linux source - working branch [e.g. rpi-5.15.y | rpi-5.19.y | rpi-6.1.y ] | # RPi GitHub Linux source - working branch [e.g. rpi-5.15.y | rpi-5.19.y | rpi-6.1.y ] |
DEV_BRANCH=rpi-6.1.y | DEV_BRANCH=rpi-6.6.y |
| |
| |
# Build variables | # Build variables |
PRGNAM=SARPi64.SlackBuild-aarch64-cc | PRGNAM=SARPi64.SlackBuild-aarch64-cc |
ARCH_TARGET=aarch64-linux | ARCH_TARGET=aarch64-linux |
LINUX_ARCH=arm64 | LINUX_ARCH=arm64 |
QUADLET=aarch64-unknown-linux-gnu # aarch64-arm-none-eabi | QUADLET=aarch64-unknown-linux-gnu # aarch64-arm-none-eabi |
RPI_GITURL_LINUX=https://github.com/raspberrypi | RPI_GITURL_LINUX=https://github.com/raspberrypi |
BUILD_LANGUAGES="--enable-languages=c,c++" # --enable-languages=all,ada,c,c++,fortran,go,jit,lto,objc,obj-c++ | BUILD_LANGUAGES="--enable-languages=c,c++" # --enable-languages=all,ada,c,c++,fortran,go,jit,lto,objc,obj-c++ |
ALT_CONFIG_OPTIONS="--disable-multilib" # --disable-threads --disable-shared --disable-multiarch | ALT_CONFIG_OPTIONS="--disable-multilib" |
| BLD_CONFIG_OPTIONS="--disable-multilib --disable-threads --disable-shared --disable-multiarch -mcpu=cortex-a53+crc -mtune=cortex-a53 --disable-fixincludes --with-system-zlib" |
TEST_CONFIG_OPTIONS="--with-arch=armv8-a --with-tune=cortex-a72 --with-fpu=vfpv3-d16 --with-float=hard" # | TEST_CONFIG_OPTIONS="--with-arch=armv8-a --with-tune=cortex-a72 --with-fpu=vfpv3-d16 --with-float=hard" # |
RPI4_CONFIG_OPTIONS="--prefix=$INSTALL_PATH --target=arm-linux-gnueabihf --enable-languages=c,c++ --with-arch=armv8-a --with-fpu=vfp --with-float=hard --disable-multilib" # | RPI_CONFIG_OPTIONS="--prefix=$INSTALL_PATH --target=arm-linux-gnueabihf --enable-languages=c,c++ --with-arch=armv8-a --with-fpu=vfp --with-float=hard --disable-multilib" # |
PARALLEL_JOBS=-j4 # https://www.gnu.org/software/make/manual/html_node/Parallel.html | # https://www.gnu.org/software/make/manual/html_node/Parallel.html |
| PARALLEL_JOBS="-j$(nproc)" |
CWD=$(pwd) | CWD=$(pwd) |
| |
# Define CONFIG_OPTIONS for build | # Define CONFIG_OPTIONS for build |
CONFIG_OPTIONS=$ALT_CONFIG_OPTIONS | CONFIG_OPTIONS=$ALT_CONFIG_OPTIONS |
| |
| # Set bulletin |
| set -e |
| |
| # INSTALL_PATH needs to be at the front of $PATH |
| # Command: export PATH=/tmp/.gcc-cross/bin:$PATH |
| echo "Checking $ARCH_TARGET $INSTALL_PATH/bin \$PATH ..." |
| if [[ ! "$PATH" =~ $INSTALL_PATH ]]; then |
| export PATH=/"${INSTALL_PATH}"/bin:$PATH |
| else |
| echo "Found $INSTALL_PATH\/bin in \$PATH : OK! ... " |
| fi |
| |
# Uncomment to log EVERYTHING during build process [** WARNING! HUGE log filesize! **] | # Uncomment to log EVERYTHING during build process [** WARNING! HUGE log filesize! **] |
sarpiSP64 | sarpiSP64 |
echo "Starting $PRGNAM build ..." | echo "Starting $PRGNAM build ..." |
| |
# INSTALL_PATH needs to be at the front of $PATH | |
# Command: export PATH=/tmp/.gcc-cross/bin:$PATH | |
echo "Checking $ARCH_TARGET $INSTALL_PATH/bin \$PATH ..." | |
if [[ ! "$PATH" =~ $INSTALL_PATH ]]; then | |
export PATH=/"${INSTALL_PATH}"/bin:$PATH | |
# echo -e $INSTALL_PATH/bin:$(cat $PATH) > $PATH || exit 1 | |
else | |
echo "Found $INSTALL_PATH\/bin in \$PATH : OK! ... " | |
fi | |
| |
# Prerequisite packages | # Prerequisite packages |
echo "ERROR: bison not found!" | echo "ERROR: bison not found!" |
echo "Install bison before you run this script!" | echo "Install bison before you run this script!" |
exit 1 | exit 1; |
elif [ ! -e "$FLEX_REQ" ]; then | elif [ ! -e "$FLEX_REQ" ]; then |
echo "ERROR: flex not found!" | echo "ERROR: flex not found!" |
echo "Install flex before you run this script!" | echo "Install flex before you run this script!" |
exit 1 | exit 1; |
elif [ ! -e "$GAWK_REQ" ]; then | elif [ ! -e "$GAWK_REQ" ]; then |
echo "ERROR: gawk not found!" | echo "ERROR: gawk not found!" |
echo "Install gawk before you run this script!" | echo "Install gawk before you run this script!" |
exit 1 | exit 1; |
elif [ ! -e "$GIT_REQ" ]; then | elif [ ! -e "$GIT_REQ" ]; then |
echo "ERROR: git not found!" | echo "ERROR: git not found!" |
echo "Install git before you run this script!" | echo "Install git before you run this script!" |
exit 1 | exit 1; |
else | else |
echo "Prerequisite packages are installed ..." | echo "Prerequisite packages are installed ..." |
fi | fi |
| |
| # Delete build-binutils directory [if it exists] |
| rm -rf build-binutils |
| mkdir build-binutils |
| |
# Download RPi kernel source ** this may take a while ** | # Download RPi kernel source ** this may take a while ** |
if [ ! -e $LINUX_FLAVOUR/Makefile ]; then | if [ ! -e $LINUX_FLAVOUR/Makefile ]; then |
echo "Downloading kernel $DEV_BRANCH source ..." | echo "Downloading kernel $DEV_BRANCH source ..." |
git clone --depth=1 $RPI_GITURL_LINUX/linux.git --branch $DEV_BRANCH $LINUX_FLAVOUR | git clone --branch $DEV_BRANCH --depth=1 $RPI_GITURL_LINUX/linux.git $LINUX_FLAVOUR |
fi | fi |
cd $LINUX_FLAVOUR | cd $LINUX_FLAVOUR |
fi | fi |
| |
# Create symbolic links so gcc builds these dependencies automatically | # Create symbolic links so gcc builds these dependencies. This can be done |
| # automagically by using the following command in gcc source dir: |
| # ./contrib/download_prerequisites |
| # |
echo "Creating symbolic links in gcc ..." | echo "Creating symbolic links in gcc ..." |
cd "$CWD"/$GCC_VERSION | cd "$CWD"/$GCC_VERSION |
| ln -sf ../$GMP_VERSION gmp |
ln -sf ../$MPFR_VERSION mpfr | ln -sf ../$MPFR_VERSION mpfr |
ln -sf ../$GMP_VERSION gmp | |
ln -sf ../$MPC_VERSION mpc | ln -sf ../$MPC_VERSION mpc |
ln -sf ../$ISL_VERSION isl | ln -sf ../$ISL_VERSION isl |
ln -sf ../$CLOOG_VERSION cloog | ln -sf ../$CLOOG_VERSION cloog |
| |
# Create aarch64 cross-compiler install directory | # Create AArch64 cross-compiler install directory |
echo "Creating $INSTALL_PATH directory ..." | echo "Creating $INSTALL_PATH directory ..." |
rm -rf $INSTALL_PATH | rm -rf $INSTALL_PATH |
# Build binutils | # Build binutils |
echo "Building binutils ..." | echo "Building binutils ..." |
rm -rf build-binutils | |
mkdir build-binutils | |
cd build-binutils | cd build-binutils |
../$BINUTILS_VERSION/configure --prefix=$INSTALL_PATH --target=$ARCH_TARGET $CONFIG_OPTIONS | ../$BINUTILS_VERSION/configure --prefix=$INSTALL_PATH --target=$ARCH_TARGET $CONFIG_OPTIONS |
mkdir -p build-gcc | mkdir -p build-gcc |
cd build-gcc | cd build-gcc |
../$GCC_VERSION/configure --prefix=$INSTALL_PATH --target=$ARCH_TARGET $BUILD_LANGUAGES $CONFIG_OPTIONS | ../$GCC_VERSION/configure --prefix=$INSTALL_PATH --target=$ARCH_TARGET $BUILD_LANGUAGES $CONFIG_OPTIONS --disable-libsanitizer |
make $PARALLEL_JOBS all-gcc | make $PARALLEL_JOBS all-gcc |
echo "Installing gcc $ARCH_TARGET cross-compiler to $INSTALL_PATH ..." | echo "Installing gcc $ARCH_TARGET cross-compiler to $INSTALL_PATH ..." |
touch asan_linux-cpp.patch | touch asan_linux-cpp.patch |
cat << EOF > asan_linux-cpp.patch | cat << EOF > asan_linux-cpp.patch |
--- gcc-13.2.0/libsanitizer/asan/asan_linux.cpp 2023-07-27 09:13:08.000000000 +0100 | --- gcc-13.2.0/libsanitizer/asan/asan_linux.cpp 2023-10-15 19:29:43.000000000 +0100 |
+++ asan_linux-cpp.new 2023-10-15 14:36:04.000000000 +0100 | +++ asan_linux-cpp.new 2023-10-16 08:33:44.000000000 +0100 |
@@ -77,6 +77,10 @@ | @@ -77,6 +77,10 @@ |
asan_rt_version_t __asan_rt_version; | asan_rt_version_t __asan_rt_version; |
EOF | EOF |
| |
# Patch gcc-13.2.x/libsanitizerasan/asan_linux.cpp [or the build will fail] | # Patch gcc-13.2.x/libsanitizerasan/asan_linux.cpp [for posterity] |
ASANLINUXCC=$CWD/$GCC_VERSION/libsanitizer/asan/asan_linux.cpp | ASANLINUXCC=$CWD/$GCC_VERSION/libsanitizer/asan/asan_linux.cpp |
if [ ! -f "$ASANLINUXCC".orig ]; then | if [ ! -f "$ASANLINUXCC".orig ]; then |
echo "Patching $ASANLINUXCC ..." | echo "Patching $ASANLINUXCC ..." |
patch -b "$ASANLINUXCC" asan_linux-cpp.patch || exit 1 | patch -b "$ASANLINUXCC" asan_linux-cpp.patch || exit 1; |
sarpiSP64 | sarpiSP64 |
echo "$ASANLINUXCC has been PATCHED! ..." | echo "$ASANLINUXCC has been PATCHED! ..." |
mkdir -p build-glibc | mkdir -p build-glibc |
cd build-glibc | cd build-glibc |
../$GLIBC_VERSION/configure --prefix=$INSTALL_PATH/$ARCH_TARGET --build="$MACHTYPE" --host=$ARCH_TARGET --target=$ARCH_TARGET --with-headers=$INSTALL_PATH/$ARCH_TARGET/include $CONFIG_OPTIONS libc_cv_forced_unwind=yes | ../$GLIBC_VERSION/configure --prefix=$INSTALL_PATH/$ARCH_TARGET --build="$MACHTYPE" --host=$ARCH_TARGET --target=$ARCH_TARGET $CONFIG_OPTIONS libc_cv_forced_unwind=yes |
make $PARALLEL_JOBS install-bootstrap-headers=yes install-headers | make $PARALLEL_JOBS install-bootstrap-headers=yes install-headers |
make $PARALLEL_JOBS csu/subdir_lib | make $PARALLEL_JOBS csu/subdir_lib |
echo "Completing glibc C library ..." | echo "Completing glibc C library ..." |
cd "$CWD"/build-glibc | cd "$CWD"/build-glibc |
make $PARALLEL_JOBS | make $PARALLEL_JOBS |
echo "Installing glibc C library ..." | echo "Installing glibc C library ..." |
make install | make install |
echo "Completing glibc C++ library ..." | echo "Completing glibc C++ library ..." |
cd "$CWD"/build-gcc | cd "$CWD"/build-gcc |
make $PARALLEL_JOBS | make $PARALLEL_JOBS |
echo "Installing glibc C++ library ..." | echo "Installing glibc C++ library ..." |
make install | make install |
cd "$CWD" | cd "$CWD" |
| |
# Check status of aarch64-linux-gcc cross-compiler | # Check status of AArch64-linux-gcc cross-compiler |
echo "Checking status of $ARCH_TARGET-gcc cross-compiler ..." | echo "Checking status of $ARCH_TARGET-gcc cross-compiler ..." |
ARCH_TARGET_STATUS=$(which $ARCH_TARGET-gcc) | ARCH_TARGET_STATUS=$(which $ARCH_TARGET-gcc) |
sarpiSP64 | sarpiSP64 |
echo "$(date +"%F %T") : $PRGNAM FAILED! ..." | echo "$(date +"%F %T") : $PRGNAM FAILED! ..." |
exit 1 | exit 1; |
else | else |
# Done! | # Done! |
fi | fi |
| |
# Done | # |
exit 0 | exit 0; |
| |
#EOF<*> | #EOF<*> |
As an example to show how this can be achieved, the bespoke RPi kernel source 'master' branch will be used. This kernel source will be downloaded and located in '/tmp/linux-rpi' directory. [**NB: note that this is __NOT__ '/usr/src/linux' - it should never reside in that standard location for cross-compiling purposes!**]. After downloading the Linux source, use 'cd' to the directory where it's located: | As an example to show how this can be achieved, the bespoke RPi kernel source 'master' branch will be used. This kernel source will be downloaded and located in '/tmp/linux-rpi' directory. [**NB: note that this is __NOT__ '/usr/src/linux' - it should never reside in that standard location for cross-compiling purposes!**]. After downloading the Linux source, use 'cd' to the directory where it's located: |
| |
<code>root@slackware:~# git clone --depth=1 --branch=rpi-5.19.y git://github.com/raspberrypi/linux /tmp/linux-rpi | <code>root@slackware:~# git clone --depth=1 --branch=rpi-6.1.y git://github.com/raspberrypi/linux /tmp/linux-rpi |
Cloning into '/tmp/linux-rpi'... | Cloning into '/tmp/linux-rpi'... |
~ Enumerating, Counting, Compressing, yadda yadda yadda ~ | ~ Enumerating, Counting, Compressing, yadda yadda yadda ~ |
root@slackware:/tmp/linux-rpi# </code> | root@slackware:/tmp/linux-rpi# </code> |
| |
We use '--branch=rpi-5.19.y' option to download the Linux kernel 5.19.x source specifically. We also use '--depth=1' option to only download the latest commit and not the entire branch content, which may currently be +10GB in size. The actual disk space amount used for the source that's just been downloaded is: | We use '--branch=rpi-6.1.y' option to download the Linux kernel 6.1.x source specifically. We also use '--depth=1' option to only download the latest commit and not the entire branch content, which may currently be +10GB in size. The actual disk space amount used for the source that's just been downloaded is: |
| |
<code>root@slackware:/tmp/linux-rpi# du -sh /tmp/linux-rpi/ | <code>root@slackware:/tmp/linux-rpi# du -sh /tmp/linux-rpi/ |
root@slackware:/tmp/linux-rpi# </code> | root@slackware:/tmp/linux-rpi# </code> |
| |
At the time of writing, this is kernel 5.19.9 source from the Raspberry Pi Github repository 'master' branch. You can download and work with other branches by simply maniplulating the 'git' command options. Right now the downloaded kernel source is in a "raw state" (i.e. it includes no settings or configurations) and it's not going to build anything until some form of instructions exist regarding specifically how/what/which to compile. | At the time of writing, this is kernel 6.1.19 source from the Raspberry Pi Github repository 'master' branch. You can download and work with other branches by simply maniplulating the 'git' command options. Right now the downloaded kernel source is in a "raw state" (i.e. it includes no settings or configurations) and it's not going to build anything until some form of instructions exist regarding specifically how/what/which to compile. |
| |
What's missing now is a kernel '.config' - a file that includes instructions (i.e. settings) that's an essential prerequisite in order to compile the Linux source into a resulting kernel image file - and you won't be doing much without creating one first. This is __much__ easier said than done if you're starting from scratch, because it requires intimate knowledge about the the computer/device hardware that you're building the kernel to support. However, with the Raspberry Pis (and many other ARM devices) there is such a thing as a 'default config', or 'defconfig', that can be called to build the kernel '.config' file for you and save a lot of time and effort (and unfortunately a huge amount of education and experience is also wasted in this process). So in the interest of saving time, let's do it the easy and lazy way for this example... | What's missing now is a kernel '.config' - a file that includes instructions (i.e. settings) that's an essential prerequisite in order to compile the Linux source into a resulting kernel image file - and you won't be doing much without creating one first. This is __much__ easier said than done if you're starting from scratch, because it requires intimate knowledge about the the computer/device hardware that you're building the kernel to support. However, with the Raspberry Pis (and many other ARM devices) there is such a thing as a 'default config', or 'defconfig', that can be called to build the kernel '.config' file for you and save a lot of time and effort (and unfortunately a huge amount of education and experience is also wasted in this process). So in the interest of saving time, let's do it the easy and lazy way for this example... |
# | # |
# Automatically generated file; DO NOT EDIT. | # Automatically generated file; DO NOT EDIT. |
# Linux/arm64 5.19.9 Kernel Configuration | # Linux/arm64 6.1.57 Kernel Configuration |
# | # |
CONFIG_CC_VERSION_TEXT="gcc (GCC) 13.2.0" | CONFIG_CC_VERSION_TEXT="aarch64-linux-gcc (GCC) 11.2.0" |
CONFIG_CC_IS_GCC=y | CONFIG_CC_IS_GCC=y |
CONFIG_GCC_VERSION=120200 | CONFIG_GCC_VERSION=110200 |
CONFIG_CLANG_VERSION=0 | CONFIG_CLANG_VERSION=0 |
CONFIG_AS_IS_GNU=y | CONFIG_AS_IS_GNU=y |
CONFIG_AS_VERSION=23900 | CONFIG_AS_VERSION=23800 |
root@slackware:/tmp/linux-rpi# </code> | root@slackware:/tmp/linux-rpi# </code> |
| |
# If you need to install any of the pre-requisite software here are the links [**NB: check for updates!**]: | # If you need to install any of the pre-requisite software here are the links [**NB: check for updates!**]: |
| |
[[ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/a/]] # Slackware ARM current - gawk package. \\ | [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-15.0/slackware/a/]] # Slackware ARM 15.0 - gawk package. \\ |
[[ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/]] # Slackware ARM current - git package. \\ | [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-15.0/slackware/d/]] # Slackware ARM 15.0 - git package. \\ |
[[ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/]] # Slackware ARM current - bison package. \\ | [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-15.0/slackware/d/]] # Slackware ARM 15.0 - bison package. \\ |
[[ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/]] # Slackware ARM current - flex package. \\ | [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-15.0/slackware/d/]] # Slackware ARM 15.0 - flex package. \\ |
[[https://www.github.com/raspberrypi/]] # Raspberry Pi Foundation GitHub repository Linux kernel and boot-firmware source. \\ | [[https://www.github.com/raspberrypi/]] # Raspberry Pi Foundation GitHub repository Linux kernel and boot-firmware source. \\ |
[[https://ftp.gnu.org/gnu/]] # gcc, binutils, glibc, gmp, mpc, mpfr package source. \\ | [[https://ftp.gnu.org/gnu/]] # gcc, binutils, glibc, gmp, mpc, mpfr package source. \\ |
[[ftp://gcc.gnu.org/pub/gcc/infrastructure]] # cloog, isl package source. | [[https://gcc.gnu.org/pub/gcc/infrastructure]] # cloog, isl package source. |
| |
# Documentation which assisted in this guide: | # Documentation which assisted in this guide: |
<!-- * Contributions by [[wiki:user:yyy | User Y]] --> | <!-- * Contributions by [[wiki:user:yyy | User Y]] --> |
| |
* Originally written by [[wiki:user:exaga | Exaga]] - 2022-09-19 18:38:25 [GMT] | * Originally written by [[wiki:user:exaga | Exaga]] - 2023-10-15 16:09:17 [UTC] |
| |
<!-- Please do not modify anything below, except adding new tags.--> | <!-- Please do not modify anything below, except adding new tags.--> |