2018-06-21 18:33:30 +02:00
|
|
|
#!/bin/sh -xe
|
|
|
|
|
|
|
|
#Build kenerl, wifi firmware
|
|
|
|
|
|
|
|
|
2018-10-11 22:09:25 +02:00
|
|
|
# This file is part of PrawnOS (http://www.prawnos.com)
|
|
|
|
# Copyright (c) 2018 Hal Emmerich <hal@halemmerich.com>
|
|
|
|
|
|
|
|
# PrawnOS is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License version 2
|
|
|
|
# as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
# PrawnOS is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
2019-02-27 20:20:11 +01:00
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
|
|
|
echo "No kernel version supplied"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
KVER=$1
|
2018-08-24 20:20:24 +02:00
|
|
|
TEST_PATCHES=false
|
2018-09-06 01:35:33 +02:00
|
|
|
ROOT_DIR=`pwd`
|
|
|
|
RESOURCES=$ROOT_DIR/resources/BuildResources
|
2018-09-06 15:46:45 +02:00
|
|
|
[ ! -d build ] && mkdir build
|
2018-09-06 01:35:33 +02:00
|
|
|
cd build
|
2019-09-21 06:50:08 +02:00
|
|
|
if [ ! -f PrawnOS-initramfs.cpio.gz ]
|
|
|
|
then
|
|
|
|
echo "No initramfs image, run 'make initramfs' first"
|
|
|
|
cd $ROOT_DIR
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-07-14 05:53:46 +02:00
|
|
|
# build AR9271 firmware
|
|
|
|
[ ! -d open-ath9k-htc-firmware ] && git clone --depth 1 https://github.com/qca/open-ath9k-htc-firmware.git
|
|
|
|
cd open-ath9k-htc-firmware
|
|
|
|
make toolchain
|
|
|
|
make -C target_firmware
|
|
|
|
cd ..
|
|
|
|
|
2018-09-20 17:10:47 +02:00
|
|
|
# build Linux-libre, with ath9k_htc
|
2018-06-21 18:33:30 +02:00
|
|
|
[ ! -f linux-libre-$KVER-gnu.tar.lz ] && wget https://www.linux-libre.fsfla.org/pub/linux-libre/releases/$KVER-gnu/linux-libre-$KVER-gnu.tar.lz
|
2019-10-15 15:43:50 +02:00
|
|
|
[ ! -f linux-libre-$KVER-gnu.tar.lz.sign ] && wget https://www.linux-libre.fsfla.org/pub/linux-libre/releases/$KVER-gnu/linux-libre-$KVER-gnu.tar.lz.sign
|
2019-10-13 00:49:59 +02:00
|
|
|
|
2019-10-15 15:43:50 +02:00
|
|
|
#verify the signature
|
|
|
|
gpg --import $RESOURCES/linux-libre-signing-key.gpg
|
|
|
|
gpg --verify linux-libre-$KVER-gnu.tar.lz.sign linux-libre-$KVER-gnu.tar.lz
|
2019-10-13 00:49:59 +02:00
|
|
|
|
2018-08-23 21:43:20 +02:00
|
|
|
[ ! -d linux-$KVER ] && tar --lzip -xvf linux-libre-$KVER-gnu.tar.lz && FRESH=true
|
2018-06-21 18:33:30 +02:00
|
|
|
cd linux-$KVER
|
|
|
|
make clean
|
|
|
|
make mrproper
|
2018-08-24 20:20:24 +02:00
|
|
|
#Apply the usb and mmc patches if unapplied
|
2019-08-22 00:31:41 +02:00
|
|
|
[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/kernel/5.x-dwc2/*.patch; do echo $i; patch -p1 < $i; done
|
2019-08-26 02:30:11 +02:00
|
|
|
[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/DTS/*.patch; do echo $i; patch -p1 < $i; done
|
|
|
|
[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/kernel/*.patch; do echo $i; patch -p1 < $i; done
|
2018-09-20 17:10:47 +02:00
|
|
|
|
2019-09-21 06:50:08 +02:00
|
|
|
#copy in the initramfs and kernel config
|
|
|
|
cp $ROOT_DIR/build/PrawnOS-initramfs.cpio.gz .
|
2018-09-06 01:35:33 +02:00
|
|
|
cp $RESOURCES/config .config
|
2020-02-29 16:53:29 +01:00
|
|
|
make -j $((`nproc` +1)) CROSS_COMPILE=arm-none-eabi- ARCH=arm zImage modules dtbs
|
2018-09-06 01:35:33 +02:00
|
|
|
[ ! -h kernel.its ] && ln -s $RESOURCES/kernel.its .
|
2018-06-21 18:33:30 +02:00
|
|
|
mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg
|
|
|
|
dd if=/dev/zero of=bootloader.bin bs=512 count=1
|
|
|
|
vbutil_kernel --pack vmlinux.kpart \
|
|
|
|
--version 1 \
|
|
|
|
--vmlinuz vmlinux.uimg \
|
|
|
|
--arch arm \
|
|
|
|
--keyblock /usr/share/vboot/devkeys/kernel.keyblock \
|
|
|
|
--signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
|
2018-09-06 01:35:33 +02:00
|
|
|
--config $RESOURCES/cmdline \
|
2018-06-21 18:33:30 +02:00
|
|
|
--bootloader bootloader.bin
|
|
|
|
cd ..
|
2018-09-06 01:35:33 +02:00
|
|
|
cd $ROOT_DIR
|