diff --git a/build-kernel.sh b/build-kernel.sh index 7baa491..c3c0fd2 100755 --- a/build-kernel.sh +++ b/build-kernel.sh @@ -3,20 +3,21 @@ set -e set -x # Create target dir for build artefacts -CDIR=$PWD -BUILD_NR=$(date '+%Y%m%d-%H%M%S') +WORKDIR=$PWD +BUILD_NR=${BUILD_NR:=$(date '+%Y%m%d-%H%M%S')} BUILD_DEST=/builds/$BUILD_NR mkdir -p $BUILD_DEST # Get the Linux kernel 4.9 source +BRANCH=rpi-4.9.y if [[ -d $LINUX ]]; then # update kernel repo cd $LINUX git pull - git checkout rpi-4.9.y + git checkout $BRANCH else # clone kernel repo - git clone --single-branch --branch rpi-4.9.y --depth 1 https://www.github.com/raspberrypi/linux $LINUX + git clone --single-branch --branch $BRANCH --depth 1 https://www.github.com/raspberrypi/linux $LINUX cd $LINUX fi @@ -42,7 +43,7 @@ $MAKE $MAKE modules # Install modules -INSTALLDIR=$CDIR/$KR +INSTALLDIR=$WORKDIR/$KR if [[ -d $INSTALLDIR ]]; then rm -fr $INSTALLDIR mkdir -p $INSTALLDIR @@ -59,9 +60,18 @@ cp arch/arm64/boot/Image $INSTALLDIR/boot/kernel8.img cp arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb $INSTALLDIR/boot/ cp arch/arm64/boot/dts/overlays/*.dtbo $INSTALLDIR/boot/overlays/ -# Create tar file -tar -cjvf $CDIR/$KR.tar.bz2 -C $INSTALLDIR . +# Create tar file, all kernel files +TARFILE1=$KR.tar.gz +tar -cvzf $WORKDIR/$TARFILE1 -C $INSTALLDIR . +cd $WORKDIR +sha256sum $TARFILE1 > $TARFILE1.sha256 + +# Create tar file, only bootfiles +TARFILE2=bootfiles.tar.gz +tar -cvzf $WORKDIR/$TARFILE2 -C $INSTALLDIR/boot . +cd $WORKDIR +sha256sum $TARFILE2 > $TARFILE2.sha256 # Copy build artefacts -cp $CDIR/$KR.tar.bz2 $BUILD_DEST/ -cp -R $INSTALLDIR/boot $BUILD_DEST/ +cp $TARFILE1* $BUILD_DEST/ +cp $TARFILE2* $BUILD_DEST/