Skip to content

Commit

Permalink
Improve kernel build script
Browse files Browse the repository at this point in the history
  • Loading branch information
DieterReuter committed Jan 17, 2017
1 parent ab0b922 commit dd625b2
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions build-kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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/

0 comments on commit dd625b2

Please sign in to comment.