problems packaging kernel

Ralf Mardorf silver.bullet at zoho.com
Mon Jul 8 09:10:05 UTC 2019


While I used make-kpkg to build kernel packages for Ubuntu in the past
without issues, but I didn't use an Ubuntu source, instead I downloaded
sources for the kernels and in my case the rt patches from kernel.org,
you could try to do it as described by the Ubuntu Wiki, that was last
edited 2019-06-23 01:33:55, https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel.



[weremouse at moonstudio tmp]$ apt-get source linux-image-unsigned-4.4.0-154-generic
[snip]
[weremouse at moonstudio tmp]$ ls -hAl
total 142M
drwxrwxr-x 29 weremouse weremouse  840 Jul  8 10:34 linux-4.4.0
-rw-r--r--  1 weremouse weremouse  15M Jun 25 18:58 linux_4.4.0-154.181.diff.gz
-rw-r--r--  1 weremouse weremouse  12K Jun 25 18:58 linux_4.4.0-154.181.dsc
-rw-r--r--  1 weremouse weremouse 127M Jan 21  2016 linux_4.4.0.orig.tar.gz



linux-4.4.0/ contains a README, I ignored it and extracted the tarball:



[weremouse at moonstudio tmp]$ tar xzf linux_4.4.0.orig.tar.gz
[weremouse at moonstudio tmp]$ ls -hAl
total 142M
drwxrwxr-x 24 weremouse weremouse  700 Jan 11  2016 linux-4.4
drwxrwxr-x 29 weremouse weremouse  840 Jul  8 10:34 linux-4.4.0
-rw-r--r--  1 weremouse weremouse  15M Jun 25 18:58 linux_4.4.0-154.181.diff.gz
-rw-r--r--  1 weremouse weremouse  12K Jun 25 18:58 linux_4.4.0-154.181.dsc
-rw-r--r--  1 weremouse weremouse 127M Jan 21  2016 linux_4.4.0.orig.tar.gz
[weremouse at moonstudio tmp]$ diff -r linux-4.4/ linux-4.4.0/
[snip]
[weremouse at moonstudio tmp]$ diff linux-4.4/ linux-4.4.0/ | grep -e Only\ in -e Common\ subdirectories
Common subdirectories: linux-4.4/arch and linux-4.4.0/arch
Common subdirectories: linux-4.4/block and linux-4.4.0/block
Common subdirectories: linux-4.4/certs and linux-4.4.0/certs
Common subdirectories: linux-4.4/crypto and linux-4.4.0/crypto
Only in linux-4.4.0/: debian
Only in linux-4.4.0/: debian.master
Common subdirectories: linux-4.4/Documentation and linux-4.4.0/Documentation
Common subdirectories: linux-4.4/drivers and linux-4.4.0/drivers
Only in linux-4.4.0/: dropped.txt
Common subdirectories: linux-4.4/firmware and linux-4.4.0/firmware
Common subdirectories: linux-4.4/fs and linux-4.4.0/fs
Common subdirectories: linux-4.4/include and linux-4.4.0/include
Common subdirectories: linux-4.4/init and linux-4.4.0/init
Common subdirectories: linux-4.4/ipc and linux-4.4.0/ipc
Common subdirectories: linux-4.4/kernel and linux-4.4.0/kernel
Common subdirectories: linux-4.4/lib and linux-4.4.0/lib
Common subdirectories: linux-4.4/mm and linux-4.4.0/mm
Common subdirectories: linux-4.4/net and linux-4.4.0/net
Common subdirectories: linux-4.4/samples and linux-4.4.0/samples
Common subdirectories: linux-4.4/scripts and linux-4.4.0/scripts
Common subdirectories: linux-4.4/security and linux-4.4.0/security
Only in linux-4.4.0/: snapcraft.yaml
Common subdirectories: linux-4.4/sound and linux-4.4.0/sound
Only in linux-4.4.0/: spl
Common subdirectories: linux-4.4/tools and linux-4.4.0/tools
Only in linux-4.4.0/: ubuntu
Common subdirectories: linux-4.4/usr and linux-4.4.0/usr
Common subdirectories: linux-4.4/virt and linux-4.4.0/virt
Only in linux-4.4.0/: zfs



Consider to try the way described by the Wiki and don't use the tarball, but the linux-4.4.0/ directory, since it contains additional information.

FWIW, I found a script, but don't remember if it worked, probably I did it manually in a similar way, but for sure using make-kpkg:



[root at archlinux rocketmouse]# cat /mnt/q/usr/src/ubuntu_quantal_rt.sh 
#!/bin/sh
# sh ubuntu_quantal_rt.sh
TODAY=2013-Aug-27

 GENERIC=3.6.5-rt14
 ARCH=x86_64
 export CONCURRENCY_LEVEL=2

 # Kernel to build is version
 KMAJOR=3.10
 KMINOR=.9
 KMICRO=-rt5
 KERNEL_UNAME=${KMAJOR}${KMINOR}${KMICRO}

 # Directory where the source codes should be saved
 SRC_DIR=/usr/src

clear
if [ $USER = "root" ] ; then
 if [ $(uname -m) != ${ARCH} ] ; then
  echo "#######################################"
  echo "You're running the wrong architecture"
  echo "Continuing anyway"
  echo "#######################################"
 fi
 if [ $(uname -r) != ${GENERIC} ] ; then
  echo "#######################################"
  echo "You're running the wrong kernel"
  echo "Continuing anyway"
  echo "#######################################"
 fi

 # Backup configuration, delete sources and packages in SRC_DIR
 cd $SRC_DIR
 cp linux-${KERNEL_UNAME}/.config config-${KERNEL_UNAME}_$(date +"%b-%d-%Y_%H-%M-%S")
 rm -r linux-${KERNEL_UNAME}
 rm linux-headers-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb
 rm linux-image-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb
 rm linux-${KMAJOR}${KMINOR}.tar.bz2 patch-${KERNEL_UNAME}.patch.bz2
 
 # Download all sources to source directory
 wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.9.tar.bz2
 wget https://www.kernel.org/pub/linux/kernel/projects/rt/3.10/patch-3.10.9-rt5.patch.bz2

 # Extracting and patching
 tar -jxf linux-${KMAJOR}${KMINOR}.tar.bz2
 mv linux-${KMAJOR}${KMINOR} linux-${KERNEL_UNAME}
 cd linux-${KERNEL_UNAME}
 bzip2 -dc ../patch-${KERNEL_UNAME}.patch.bz2 | patch -p1
 rm ../linux-${KMAJOR}${KMINOR}.tar.bz2
 rm ../patch-${KERNEL_UNAME}.patch.bz2

 # Configuration
 cp /boot/config-$(uname -r) .config
 # Optimize to CPU
 # e.g. set to CONFIG_MK8=y (Opteron/Athlon64/Hammer/K8), command out for default
 echo "CONFIG_MK8=y" >> .config
 
 # 32-bit only
 # HIGHMEM from 4G to 64G
 # echo "CONFIG_HIGHMEM4G is not set" >> .config
 # echo "CONFIG_HIGHMEM64G=y" >> .config
 
 # [...]
 SECONDS=0
 make oldconfig
 sec_oldconfig=$SECONDS
 SECONDS=0

 # Building the kernel
 make-kpkg clean
 make-kpkg --rootcmd fakeroot --initrd kernel-image kernel-headers

 # Installing new packages
 make-kpkg clean
 dpkg -i ../linux-headers-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb
 dpkg -i ../linux-image-${KERNEL_UNAME}_${KERNEL_UNAME}-10.00.Custom_*.deb
 echo "-------------------------------"
 echo "Config           : $sec_oldconfig sec"
 echo "Build and install: $SECONDS sec"
else
 echo "Run as \"root\""
fi
exit 0



I definitively build the rt kernels exactly like that or at least very
similar for Ubuntu 12.10 (Quantal Quetzal), it's still installed and I
still can boot vmlinuz-3.6.5-rt14 and I most likely build rt kernels
like that for Ubuntu 14.04 LTS (Trusty Tahr), too, but it's not installed anymore.



[root at archlinux rocketmouse]# ls -hld /mnt/q/usr/src/*linux*3*
drwxrwxr-x 23 root root 4.0K Dec 28  2017 /mnt/q/usr/src/linux-3.10.9-rt5
-rw-r--r--  1 root root 8.4M Aug 27  2013 /mnt/q/usr/src/linux-headers-3.10.9-rt5_3.10.9-rt5-10.00.Custom_amd64.deb
drwxr-xr-x 24 root root 4.0K Dec 28  2017 /mnt/q/usr/src/linux-headers-3.5.0-18
drwxr-xr-x  7 root root 4.0K Dec 28  2017 /mnt/q/usr/src/linux-headers-3.5.0-18-lowlatency
drwxr-xr-x 23 root root 4.0K Dec 28  2017 /mnt/q/usr/src/linux-headers-3.6.5-rt14
-rw-r--r--  1 root root  40M Aug 27  2013 /mnt/q/usr/src/linux-image-3.10.9-rt5_3.10.9-rt5-10.00.Custom_amd64.deb
[root at archlinux rocketmouse]# ls -hl /.boot/ubuntu_q/boot/vmlinuz-*
-rw-r--r-- 1 root root 5.1M Aug 27  2013 /.boot/ubuntu_q/boot/vmlinuz-3.10.9-rt5
-rw------- 1 root root 5.0M Oct 20  2012 /.boot/ubuntu_q/boot/vmlinuz-3.5.0-18-lowlatency
-rw-r--r-- 1 root root 5.0M Nov  2  2012 /.boot/ubuntu_q/boot/vmlinuz-3.6.5-rt14
[root at archlinux rocketmouse]# grep LABEL\ Light -A4 /boot/syslinux/syslinux.cfg
LABEL Light
    MENU LABEL Ubuntu ^Q LightScribe Rt (no bind to /boot)
    LINUX /.boot/ubuntu_q/boot/vmlinuz-3.6.5-rt14
    APPEND root=LABEL=q ro nomodeset
    INITRD /.boot/ubuntu_q/boot/initrd.img-3.6.5-rt14



Regards,
Ralf





More information about the ubuntu-users mailing list