Updated build script with new features (e.g. automatic kernel release detection, commit hashes for sourced kernels, etc)
This commit is contained in:
parent
b2214c9509
commit
e8e0987200
@ -1,7 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
ARMBIAN_KERNEL_PATCH_RELEASE=$(cat "armbian-rk-6.1-rkr5-patch-release")
|
||||||
|
COOLPI_KERNEL_PATCH_RELEASE=$(cat "coolpi-linux-6.1-stan-rkr3.1-patch-release")
|
||||||
|
|
||||||
|
VERSION=$(awk 'NR==2 {print $3}' Makefile)
|
||||||
|
PATCHLEVEL=$(awk 'NR==3 {print $3}' Makefile)
|
||||||
|
SUBLEVEL=$(awk 'NR==4 {print $3}' Makefile)
|
||||||
|
|
||||||
|
K_VER="$VERSION.$PATCHLEVEL.$SUBLEVEL"
|
||||||
K_SRC=`pwd`
|
K_SRC=`pwd`
|
||||||
|
|
||||||
|
WELCOME_MESSAGE="Welcome to the CoolPi Linux LTS v$K_VER kernel deployment tool!"
|
||||||
|
MESSAGE_LENGTH=${#WELCOME_MESSAGE}
|
||||||
|
|
||||||
ARCH=`uname -m`
|
ARCH=`uname -m`
|
||||||
if [ "$ARCH" == "x86_64" ]; then
|
if [ "$ARCH" == "x86_64" ]; then
|
||||||
export CROSS_COMPILE=aarch64-linux-gnu-
|
export CROSS_COMPILE=aarch64-linux-gnu-
|
||||||
@ -11,10 +22,15 @@ fi
|
|||||||
|
|
||||||
export ARCH=arm64
|
export ARCH=arm64
|
||||||
echo
|
echo
|
||||||
echo "Welcome to using Coolpi Development Board!"
|
echo "$WELCOME_MESSAGE"
|
||||||
echo "------------------------------------------"
|
printf '%*s\n' "$MESSAGE_LENGTH" | tr ' ' '-'
|
||||||
|
echo
|
||||||
|
echo "Armbian Kernel Patch Release: $ARMBIAN_KERNEL_PATCH_RELEASE (Branch: rk-6.1-rkr5)"
|
||||||
|
echo "CoolPi Kernel Patch Release: $COOLPI_KERNEL_PATCH_RELEASE (Branch: linux-6.1-stan-rkr3.1)"
|
||||||
|
echo
|
||||||
echo "Please enter a number to select your machine"
|
echo "Please enter a number to select your machine"
|
||||||
echo
|
echo
|
||||||
|
echo "0. Reset Directory"
|
||||||
echo "1. cp4b"
|
echo "1. cp4b"
|
||||||
echo "2. cp4b-hdmi-in"
|
echo "2. cp4b-hdmi-in"
|
||||||
echo "3. cm5-evb"
|
echo "3. cm5-evb"
|
||||||
@ -24,11 +40,20 @@ echo "6. cm5-notebook"
|
|||||||
echo "7. cm5-notebook-v20"
|
echo "7. cm5-notebook-v20"
|
||||||
echo "8. cm5-8uart"
|
echo "8. cm5-8uart"
|
||||||
echo "9. cpnano"
|
echo "9. cpnano"
|
||||||
echo "10. exit"
|
echo "10. Exit Script"
|
||||||
echo
|
echo
|
||||||
read -rp "Enter option number: " choice
|
read -rp "Option: " choice
|
||||||
|
|
||||||
case $choice in
|
case $choice in
|
||||||
|
0)
|
||||||
|
make clean mrproper
|
||||||
|
echo
|
||||||
|
echo "----------------"
|
||||||
|
echo "Action Completed"
|
||||||
|
echo "----------------"
|
||||||
|
echo
|
||||||
|
./build-kernel.sh
|
||||||
|
;;
|
||||||
1)
|
1)
|
||||||
echo "BOARD=cp4b"
|
echo "BOARD=cp4b"
|
||||||
BOARD="cp4b"
|
BOARD="cp4b"
|
||||||
@ -174,7 +199,6 @@ if [ "$RV1106" == "1" ]; then
|
|||||||
#cp demo-cfgs/cmdline.txt out/cmdline.txt
|
#cp demo-cfgs/cmdline.txt out/cmdline.txt
|
||||||
#cp demo-cfgs/$txt_config_file out/config.txt
|
#cp demo-cfgs/$txt_config_file out/config.txt
|
||||||
cp demo-cfgs/$txt_extconf_file out/extlinux/extlinux.conf
|
cp demo-cfgs/$txt_extconf_file out/extlinux/extlinux.conf
|
||||||
cp demo-cfgs/initrd32.img out/initrd32.img
|
|
||||||
else
|
else
|
||||||
make ARCH=arm64 LOCALVERSION= $cfg
|
make ARCH=arm64 LOCALVERSION= $cfg
|
||||||
make ARCH=arm64 LOCALVERSION= -j8
|
make ARCH=arm64 LOCALVERSION= -j8
|
||||||
@ -189,11 +213,11 @@ else
|
|||||||
rm -rf out_modules
|
rm -rf out_modules
|
||||||
mkdir -p out_modules
|
mkdir -p out_modules
|
||||||
rm -rf out_headers
|
rm -rf out_headers
|
||||||
mkdir -p out_headers/usr/src/linux-headers-6.1.75
|
mkdir -p out_headers/usr/src/linux-headers-$K_VER
|
||||||
|
|
||||||
cd $K_SRC
|
cd $K_SRC
|
||||||
make ARCH=arm64 modules_install INSTALL_MOD_PATH=out_modules
|
make ARCH=arm64 modules_install INSTALL_MOD_PATH=out_modules
|
||||||
make ARCH=arm64 headers_install INSTALL_HDR_PATH=out_headers/usr/src/linux-headers-6.1.75
|
make ARCH=arm64 headers_install INSTALL_HDR_PATH=out_headers/usr/src/linux-headers-$K_VER
|
||||||
rm -rf out
|
rm -rf out
|
||||||
mkdir -p out/extlinux
|
mkdir -p out/extlinux
|
||||||
cp vmlinuz out/
|
cp vmlinuz out/
|
||||||
@ -201,14 +225,13 @@ else
|
|||||||
cp demo-cfgs/cmdline.txt out/cmdline.txt
|
cp demo-cfgs/cmdline.txt out/cmdline.txt
|
||||||
cp demo-cfgs/$txt_config_file out/config.txt
|
cp demo-cfgs/$txt_config_file out/config.txt
|
||||||
cp demo-cfgs/$txt_extconf_file out/extlinux/extlinux.conf
|
cp demo-cfgs/$txt_extconf_file out/extlinux/extlinux.conf
|
||||||
cp demo-cfgs/initrd.img out/initrd.img
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd $K_SRC/out_modules/lib/modules/6.1.75
|
cd $K_SRC/out_modules/lib/modules/$K_VER
|
||||||
unlink source
|
unlink source
|
||||||
unlink build
|
unlink build
|
||||||
ln -sf /usr/src/linux-headers-6.1.75/ build
|
ln -sf /usr/src/linux-headers-$K_VER/ build
|
||||||
ln -sf /usr/src/linux-headers-6.1.75/ source
|
ln -sf /usr/src/linux-headers-$K_VER/ source
|
||||||
cd $K_SRC/out_modules/lib/
|
cd $K_SRC/out_modules/lib/
|
||||||
tar -czf ../../modules.tar.gz *
|
tar -czf ../../modules.tar.gz *
|
||||||
cd $K_SRC/out_headers/usr/
|
cd $K_SRC/out_headers/usr/
|
||||||
@ -237,40 +260,39 @@ mkdir -m 0755 -p $KDEB_DIR/DEBIAN
|
|||||||
cd $KDEB_DIR
|
cd $KDEB_DIR
|
||||||
mkdir -p boot/firmware && cp -a $K_SRC/out/* boot/firmware/
|
mkdir -p boot/firmware && cp -a $K_SRC/out/* boot/firmware/
|
||||||
mkdir -p usr/lib && cp -a $K_SRC/out_modules/lib/modules usr/lib/
|
mkdir -p usr/lib && cp -a $K_SRC/out_modules/lib/modules usr/lib/
|
||||||
cp $K_SRC/demo-cfgs/initrd.img boot/firmware/
|
|
||||||
cat << EOF > $KDEB_DIR/DEBIAN/control
|
cat << EOF > $KDEB_DIR/DEBIAN/control
|
||||||
Package: linux-image-6.1.75
|
Package: linux-image-$K_VER
|
||||||
Source: linux-6.1.75
|
Source: linux-$K_VER
|
||||||
Version: 100
|
Version: 100
|
||||||
Architecture: arm64
|
Architecture: arm64
|
||||||
Maintainer: coolpi <coolpi@coolpi>
|
Maintainer: rockchip <service@rock-chips.com> armbian <info@armbian.com> nathan <nathan@thesourcevaultproject.com> coolpi <coolpi@coolpi>
|
||||||
Section: kernel
|
Section: kernel
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Homepage: https://www.kernel.org/
|
Homepage: https://www.kernel.org/
|
||||||
Description: Linux kernel, version 100
|
Description: Linux kernel, version $K_VER
|
||||||
This package contains the Linux kernel, modules and corresponding other
|
This package contains the Linux kernel, modules and corresponding other
|
||||||
files, version: 6.1.75.
|
files, version: $K_VER.
|
||||||
EOF
|
EOF
|
||||||
cd $KDEB_DIR && dpkg-deb "--root-owner-group" --build . ..
|
cd $KDEB_DIR && dpkg-deb "--root-owner-group" --build . ..
|
||||||
|
|
||||||
cd $K_SRC
|
cd $K_SRC
|
||||||
KHDEB_DIR=$K_SRC/.tmp_h
|
KHDEB_DIR=$K_SRC/.tmp_h
|
||||||
HDR_DIR=$KHDEB_DIR/usr/src/linux-headers-6.1.75
|
HDR_DIR=$KHDEB_DIR/usr/src/linux-headers-$K_VER
|
||||||
rm -rf $KHDEB_DIR
|
rm -rf $KHDEB_DIR
|
||||||
mkdir -m 0755 -p $KHDEB_DIR/DEBIAN
|
mkdir -m 0755 -p $KHDEB_DIR/DEBIAN
|
||||||
mkdir -p $HDR_DIR
|
mkdir -p $HDR_DIR
|
||||||
cat << EOF > $KHDEB_DIR/DEBIAN/control
|
cat << EOF > $KHDEB_DIR/DEBIAN/control
|
||||||
Package: linux-headers-6.1.75
|
Package: linux-headers-$K_VER
|
||||||
Source: linux-6.1.75
|
Source: linux-$K_VER
|
||||||
Version: 100
|
Version: 100
|
||||||
Architecture: arm64
|
Architecture: arm64
|
||||||
Maintainer: coolpi <coolpi@coolpi>
|
Maintainer: rockchip <service@rock-chips.com> armbian <info@armbian.com> nathan <nathan@thesourcevaultproject.com> coolpi <coolpi@coolpi>
|
||||||
Section: kernel
|
Section: kernel
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Homepage: https://www.kernel.org/
|
Homepage: https://www.kernel.org/
|
||||||
Description: Linux kernel headers, version 100
|
Description: Linux kernel headers, version $K_VER
|
||||||
This package contains the Linux kernel, modules and corresponding other
|
This package contains the Linux kernel, modules and corresponding other
|
||||||
files, version: 6.1.75.
|
files, version: $K_VER.
|
||||||
EOF
|
EOF
|
||||||
(
|
(
|
||||||
cd $K_SRC
|
cd $K_SRC
|
||||||
|
Loading…
x
Reference in New Issue
Block a user