Lts kernel compile 5.10 all tarball: Difference between revisions
From embeddedTS Manuals
(typo) |
(Script updates) |
||
Line 1: | Line 1: | ||
<source lang=bash> | <source lang=bash> | ||
#!/bin/bash | #!/bin/bash -e | ||
# Generic build script that is designed to output a kernel tarball | # Generic build script that is designed to output a kernel tarball | ||
Line 6: | Line 6: | ||
# script. | # script. | ||
# Need to export CROSS_COMPILE ahead of time. | # Need to export CROSS_COMPILE ahead of time. | ||
export CROSS_COMPILE=arm-linux-gnueabihf- | #export CROSS_COMPILE=arm-linux-gnueabihf- | ||
export ARCH=arm | #export ARCH=arm | ||
export WILC=y | #export WILC=y | ||
TARGETS=zImage | TARGETS="zImage" | ||
if [ -n "${LOADADDR}" ]; then TARGETS+=" uImage"; fi | if [ -n "${LOADADDR}" ]; then TARGETS+=" uImage"; fi | ||
make -j$(nproc) && make | make -j$(nproc) && make ${TARGETS} && make modules | ||
TEMPDIR=$(mktemp -d) | TEMPDIR=$(mktemp -d) | ||
Line 21: | Line 21: | ||
mkdir "${TEMPDIR}/boot/" | mkdir "${TEMPDIR}/boot/" | ||
# Adds "arch/arm/boot/" path prefix to each TARGET | # Adds "arch/arm/boot/" path prefix to each TARGET | ||
cp | cp arch/arm/boot/${TARGETS// / arch/arm/boot/} "${TEMPDIR}"/boot/ | ||
# Copy the full .config file to the target, this is optional and can be removed | # Copy the full .config file to the target, this is optional and can be removed | ||
cp .config "${TEMPDIR}"/boot/config | cp .config "${TEMPDIR}"/boot/config |
Revision as of 13:42, 20 April 2023
#!/bin/bash -e
# Generic build script that is designed to output a kernel tarball
# Normally builds zImage, also can build uImage if LOADADDR is defined before calling the
# script.
# Need to export CROSS_COMPILE ahead of time.
#export CROSS_COMPILE=arm-linux-gnueabihf-
#export ARCH=arm
#export WILC=y
TARGETS="zImage"
if [ -n "${LOADADDR}" ]; then TARGETS+=" uImage"; fi
make -j$(nproc) && make ${TARGETS} && make modules
TEMPDIR=$(mktemp -d)
TEMPFILE=$(mktemp)
mkdir "${TEMPDIR}/boot/"
# Adds "arch/arm/boot/" path prefix to each TARGET
cp arch/arm/boot/${TARGETS// / arch/arm/boot/} "${TEMPDIR}"/boot/
# Copy the full .config file to the target, this is optional and can be removed
cp .config "${TEMPDIR}"/boot/config
# Copy all of the generated FDT binary files to the target
# XXX: Tested to find that *ts* only matches our boards in these cases.
cp arch/arm/boot/dts/*ts*.dtb "${TEMPDIR}"/boot/
# Install kernel modules to the target
INSTALL_MOD_PATH="${TEMPDIR}" make modules_install
# Install kernel headers to the target, this is optional in most cases and can be removed to save space on the target
make headers_install INSTALL_HDR_PATH="${TEMPDIR}"
# XXX: Need to find a way to trigger this build. Maybe an env var?
if [ "${WILC}" == "y" ]; then
CONFIG_WILC_SPI=m INSTALL_MOD_PATH="${TEMPDIR}" make M=./wilc3000-external-module modules modules_install
fi
# Use fakeroot to properly set permissions on the target folder as well as create a tarball from this.
fakeroot sh -c "chmod 755 ${TEMPDIR};
chown -R root:root ${TEMPDIR};
tar czf ${TEMPFILE}.tar.gz -C ${TEMPDIR} .";
cp ${TEMPFILE}.tar.gz embeddedTS-linux-lts-"$(date +"%Y%m%d")"-"$(git describe --abbrev=8 --dirty --always)".tar.gz
rm -rf "${TEMPDIR}" "${TEMPFILE}"