From de13bfa23487968b6a00402fc20e7ea3cce77fd1 Mon Sep 17 00:00:00 2001 From: Igor Pecovnik <igor.pecovnik@gmail.com> Date: Sun, 12 Aug 2018 14:19:51 +0200 Subject: [PATCH] Fixed Odroid C1 packaging patch --- ....10-DEFAULT-with-postinstall-scripts.patch | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/patch/kernel/odroidc1-default/packaging-3.10-DEFAULT-with-postinstall-scripts.patch b/patch/kernel/odroidc1-default/packaging-3.10-DEFAULT-with-postinstall-scripts.patch index 5c35f830e..523fdd97d 100644 --- a/patch/kernel/odroidc1-default/packaging-3.10-DEFAULT-with-postinstall-scripts.patch +++ b/patch/kernel/odroidc1-default/packaging-3.10-DEFAULT-with-postinstall-scripts.patch @@ -27,7 +27,7 @@ index 3001ec5..dc76d3c @@ -61,8 +63,30 @@ create_package() { forcearch="-DArchitecture=$debarch" fi - + + # Create preinstall and post install script to remove dtb + if [[ "$1" == *dtb* ]]; then + echo "if [ -d /boot/dtb-$version ]; then mv /boot/dtb-$version /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/preinst @@ -42,20 +42,20 @@ index 3001ec5..dc76d3c + echo "exit 0" >> $pdir/DEBIAN/postinst + chmod 775 $pdir/DEBIAN/postinst + fi -+ ++ + # Create postinstall script for headers + if [[ "$1" == *headers* ]]; then + echo "cd /usr/src/linux-headers-$version; echo \"Compiling headers - please wait ...\"; find -type f -exec touch {} +;make -s scripts >/dev/null 2>&1" >> $pdir/DEBIAN/postinst + echo "exit 0" >> $pdir/DEBIAN/postinst + chmod 775 $pdir/DEBIAN/postinst + fi -+ ++ # Create the package - dpkg-gencontrol -isp $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" + dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" dpkg --build "$pdir" .. } - + @@ -78,49 +102,76 @@ tmpdir="$objtree/debian/tmp" fwdir="$objtree/debian/fwtmp" kernel_headers_dir="$objtree/debian/hdrtmp" @@ -72,11 +72,11 @@ index 3001ec5..dc76d3c +dtb_packagename=linux-dtb"$LOCALVERSION" +libc_headers_packagename=linux-libc-dev"$LOCALVERSION" +dbg_packagename=$packagename-dbg - + if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version fi - + +# Not all arches have the same installed path in debian +# XXX: have each arch Makefile export a variable of the canonical image install +# path instead @@ -116,7 +116,7 @@ index 3001ec5..dc76d3c + mkdir -p "$dbg_dir/usr/share/doc/$dbg_packagename" + mkdir -m 755 -p "$dbg_dir/DEBIAN" +fi - + # Build and install the kernel if [ "$ARCH" = "um" ] ; then $MAKE linux @@ -125,7 +125,7 @@ index 3001ec5..dc76d3c + cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config" gzip "$tmpdir/usr/share/doc/$packagename/config" - cp $KBUILD_IMAGE "$tmpdir/usr/bin/linux-$version" --else +-else +else cp System.map "$tmpdir/boot/System.map-$version" - cp .config "$tmpdir/boot/config-$version" @@ -143,7 +143,7 @@ index 3001ec5..dc76d3c +else + cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path" fi - + -if grep -q '^CONFIG_MODULES=y' .config ; then +if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install @@ -172,10 +172,10 @@ index 3001ec5..dc76d3c + cp $objtree/arch/arm/boot/dts/*.dtb $dtb_dir/boot/dtb-$version + #INSTALL_DTBS_PATH="$dtb_dir/boot/dtb" $MAKE KBUILD_SRC= dtbs_install fi - + if [ "$ARCH" != "um" ]; then @@ -137,8 +206,15 @@ fi - + # Install the maintainer scripts # Note: hook scripts under /etc/kernel are also executed by official Debian -# kernel packages, as well as kernel packages built using make-kpkg @@ -193,11 +193,11 @@ index 3001ec5..dc76d3c cat <<EOF > "$tmpdir/DEBIAN/$script" @@ -147,14 +223,61 @@ for script in postinst postrm preinst prerm ; do set -e - + # Pass maintainer script parameters to hook scripts + export DEB_MAINT_PARAMS="\$*" - + -test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d +# Tell initramfs builder whether it's wanted + @@ -208,17 +208,17 @@ index 3001ec5..dc76d3c EOF chmod 755 "$tmpdir/DEBIAN/$script" done - + +## +## Create sym link to kernel image +## +kernel_tmp_version="${installed_image_path////\\/}" +sed -e "s/set -e//g" -i $tmpdir/DEBIAN/postinst +sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst -+cat >> $tmpdir/DEBIAN/postinst <<EOT ++cat >> $tmpdir/DEBIAN/postinst <<EOT +ln -sf $(basename $kernel_tmp_version) /boot/zImage > /dev/null 2>&1 || mv /$kernel_tmp_version /boot/zImage -+rm -f /boot/.next + ++rm -f /boot/.next +exit 0 +EOT +## @@ -226,7 +226,7 @@ index 3001ec5..dc76d3c +## +sed -e "s/set -e//g" -i $tmpdir/DEBIAN/preinst +sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst -+cat >> $tmpdir/DEBIAN/preinst <<EOT ++cat >> $tmpdir/DEBIAN/preinst <<EOT +# exit if we are running chroot +if [ "\$(stat -c %d:%i /)" != "\$(stat -c %d:%i /proc/1/root/.)" ]; then exit 0; fi + @@ -242,13 +242,13 @@ index 3001ec5..dc76d3c +done + +bootfstype=\$(blkid -s TYPE -o value \$boot_partition) -+if [ "\$bootfstype" = "vfat" ]; then ++if [ "\$bootfstype" = "vfat" ]; then +rm -f /boot/System.map* /boot/config* /boot/vmlinuz* /boot/zImage /boot/uImage +fi +} +mountpoint -q /boot && check_and_unmount +EOT -+echo "exit 0" >> $tmpdir/DEBIAN/preinst ++echo "exit 0" >> $tmpdir/DEBIAN/preinst + + # Try to determine maintainer and email values @@ -257,7 +257,7 @@ index 3001ec5..dc76d3c @@ -172,9 +299,19 @@ else fi maintainer="$name <$email>" - + +# Try to determine distribution +if [ -n "$KDEB_CHANGELOG_DIST" ]; then + distribution=$KDEB_CHANGELOG_DIST @@ -272,13 +272,13 @@ index 3001ec5..dc76d3c cat <<EOF > debian/changelog -linux-upstream ($packageversion) unstable; urgency=low +linux-upstream ($packageversion) $distribution; urgency=low - + * Custom built Linux kernel. - + @@ -242,21 +379,32 @@ EOF - + fi - + -# Build header package -(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles") -(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles") @@ -304,11 +304,11 @@ index 3001ec5..dc76d3c +(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" - + +(cd "$destdir"; make M=scripts clean) + cat <<EOF >> debian/control - + Package: $kernel_headers_packagename -Provides: linux-headers, linux-headers-2.6 +Provides: linux-headers @@ -316,9 +316,9 @@ index 3001ec5..dc76d3c Description: Linux kernel headers for $KERNELRELEASE on \${kernel:debarch} This package provides kernel header files for $KERNELRELEASE on \${kernel:debarch} @@ -282,6 +430,16 @@ fi - + cat <<EOF >> debian/control - + +Package: $dtb_packagename +Architecture: any +Description: Linux DTB, version $version @@ -333,15 +333,15 @@ index 3001ec5..dc76d3c Section: devel Provides: linux-kernel-headers @@ -293,9 +451,35 @@ EOF - + if [ "$ARCH" != "um" ]; then create_package "$kernel_headers_packagename" "$kernel_headers_dir" - create_package "$libc_headers_packagename" "$libc_headers_dir" +# create_package "$libc_headers_packagename" "$libc_headers_dir" fi - + create_package "$packagename" "$tmpdir" - + -exit 0 +if [ -n "$BUILD_DEBUG" ] ; then + # Build debug package