2020-05-09 11:00:02 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -x
|
|
|
|
set -e
|
2018-06-21 18:33:30 +02:00
|
|
|
|
2020-06-21 09:28:45 +02:00
|
|
|
# build Linux-libre, with ath9k_htc firmware and initramfs built in
|
2018-06-21 18:33:30 +02:00
|
|
|
|
|
|
|
|
2020-06-15 23:27:21 +02:00
|
|
|
# This file is part of PrawnOS (https://www.prawnos.com)
|
2020-06-21 09:28:45 +02:00
|
|
|
# Copyright (c) 2018-2020 Hal Emmerich <hal@halemmerich.com>
|
2018-10-11 22:09:25 +02:00
|
|
|
|
|
|
|
# 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
|
2020-06-21 09:28:45 +02:00
|
|
|
if [ -z "$2" ]
|
2019-09-21 06:50:08 +02:00
|
|
|
then
|
2020-06-21 09:28:45 +02:00
|
|
|
echo "No resources directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "$3" ]
|
|
|
|
then
|
|
|
|
echo "No build directory supplied"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if [ -z "$4" ]
|
|
|
|
then
|
|
|
|
echo "No PrawnOS initramfs supplied"
|
2019-09-21 06:50:08 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2019-10-13 00:49:59 +02:00
|
|
|
|
2020-06-21 09:28:45 +02:00
|
|
|
KVER=$1
|
|
|
|
RESOURCES=$2
|
|
|
|
BUILD_DIR=$3
|
|
|
|
INITRAMFS=$4
|
2019-10-13 00:49:59 +02:00
|
|
|
|
2020-06-21 09:28:45 +02:00
|
|
|
cd $BUILD_DIR
|
2018-06-21 18:33:30 +02:00
|
|
|
make mrproper
|
2018-09-20 17:10:47 +02:00
|
|
|
|
2020-06-21 09:28:45 +02:00
|
|
|
#copy in the resources, initramfs
|
|
|
|
cp $INITRAMFS .
|
2018-09-06 01:35:33 +02:00
|
|
|
cp $RESOURCES/config .config
|
2020-06-21 09:28:45 +02:00
|
|
|
cp $RESOURCES/kernel.its .
|
2020-05-20 20:00:00 +02:00
|
|
|
make -j $(($(nproc) +1)) CROSS_COMPILE=arm-none-eabi- ARCH=arm zImage modules dtbs
|
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
|
2020-06-21 09:28:45 +02:00
|
|
|
|
|
|
|
RESULT=$?
|
|
|
|
if [ ! $RESULT -eq 0 ]; then
|
|
|
|
rm -f vmlinux.kpart
|
|
|
|
fi
|