Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #42 from hypriot/fix-kernel-version-in-deb
Browse files Browse the repository at this point in the history
Fix kernel version in deb packages
  • Loading branch information
StefanScherer authored Mar 27, 2018
2 parents 2965abd + 224099c commit 3b3223f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
17 changes: 15 additions & 2 deletions scripts/compile_kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ fi
LINUX_KERNEL_CONFIGS=$SRC_DIR/kernel_configs

NEW_VERSION=`date +%Y%m%d-%H%M%S`

BUILD_RESULTS=$BUILD_ROOT/results/kernel-$NEW_VERSION

X64_CROSS_COMPILE_CHAIN=arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64
Expand Down Expand Up @@ -157,7 +158,12 @@ create_kernel_for () {
echo "### building kernel and deb packages"
KBUILD_DEBARCH=armhf ARCH=arm CROSS_COMPILE=${CCPREFIX[${PI_VERSION}]} make ${DEFCONFIG[${PI_VERSION}]} deb-pkg -j$NUM_CPUS

${LINUX_KERNEL}/scripts/mkknlimg --ddtk $LINUX_KERNEL/arch/arm/boot/Image $BUILD_RESULTS/$PI_VERSION/${IMAGE_NAME[${PI_VERSION}]}
version=$(${LINUX_KERNEL}/scripts/mkknlimg --ddtk $LINUX_KERNEL/arch/arm/boot/Image $BUILD_RESULTS/$PI_VERSION/${IMAGE_NAME[${PI_VERSION}]} | head -1 | sed 's/Version: //')
suffix=""
if [ "$PI_VERSION" == "rpi2_3" ]; then
suffix="7"
fi
echo "$version" > $RASPBERRY_FIRMWARE/extra/uname_string$suffix

echo "### installing kernel modules"
mkdir -p $BUILD_RESULTS/$PI_VERSION/modules
Expand Down Expand Up @@ -190,12 +196,17 @@ function create_kernel_deb_packages () {
# copy over source files for building the packages
echo "copying firmware from $RASPBERRY_FIRMWARE to $NEW_KERNEL"
# skip modules directory from standard tree, because we will our on modules below
tar --exclude=modules --exclude=.git -C $RASPBERRY_FIRMWARE -cf - . | tar -C $NEW_KERNEL -xvf -
tar --exclude=modules --exclude=headers --exclude=.git -C $RASPBERRY_FIRMWARE -cf - . | tar -C $NEW_KERNEL -xvf -
# create an empty modules directory, because we have skipped this above
mkdir -p $NEW_KERNEL/modules/
cp -r $SRC_DIR/debian $NEW_KERNEL/debian
touch $NEW_KERNEL/debian/files

mkdir -p $NEW_KERNEL/headers/
for deb in $BUILD_RESULTS/linux-headers-*.deb; do
dpkg -x $deb $NEW_KERNEL/headers/
done

for pi_version in ${!CCPREFIX[@]}; do
cp $BUILD_RESULTS/$pi_version/${IMAGE_NAME[${pi_version}]} $NEW_KERNEL/boot
cp -R $BUILD_RESULTS/$pi_version/modules/lib/modules/* $NEW_KERNEL/modules
Expand All @@ -205,6 +216,8 @@ function create_kernel_deb_packages () {
# build debian packages
cd $NEW_KERNEL

(cd $NEW_KERNEL/debian ; ./gen_bootloader_postinst_preinst.sh)

dch -v ${NEW_VERSION} --package raspberrypi-firmware 'add Hypriot custom kernel'
debuild --no-lintian -ePATH=${PATH}:$ARM_TOOLS/$X64_CROSS_COMPILE_CHAIN/bin -b -aarmhf -us -uc
cp ../*.deb $BUILD_RESULTS
Expand Down
7 changes: 4 additions & 3 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#!/bin/bash -e

echo "$CIRCLE_TAG"
echo "Circle Tag: $CIRCLE_TAG"

if [ "$CIRCLE_TAG" != "" ]; then
gem install package_cloud
package_cloud push Hypriot/rpi/debian/stretch output/*/raspberrypi-kernel*.deb
package_cloud push Hypriot/rpi/debian/stretch output/*/raspberrypi-kernel*.deb output/*/linux-libc-dev*.deb

curl -sSL https://github.com/tcnksm/ghr/releases/download/v0.5.4/ghr_v0.5.4_linux_amd64.zip -o ghr.zip
unzip ghr.zip
mkdir ghroutput
cp output/*/raspberrypi-kernel*.deb ghroutput/
cp output/*/linux-libc-dev*.deb ghroutput/

if [[ $CIRCLE_TAG = *"rc"* ]]; then
pre=-prerelease
fi
./ghr $pre -u hypriot $CIRCLE_TAG ghroutput/
./ghr $pre -u hypriot "$CIRCLE_TAG" ghroutput/

else
echo "No release tag detected. Skip deployment."
Expand Down

0 comments on commit 3b3223f

Please sign in to comment.