Hi, while struggling with various kernel bugs[1] this year I had to do a lot of rebuilds to test patches. I wanted proper source packages that I can share from my private debian repository and also wanted -headers, -dbg and -source binary packages. Most importantly I wanted proper changelog entries. I could not figure out how to do this with make-kpkg so I thought I'd dig into the real thing, linux-2.6.
http://wiki.debian.org/HowToRebuildAnOfficialDebianKernelPackage has a fairly good guide on how to rebuild kernels. However, it requires one to either recompile all flavors or to live without -headers [2]. I don't really understand the build system fully but with a patch[3] simply running "debuild --no-lintian -e DEB_BUILD_OPTIONS="parallel=4" created only linux-tools-2.6.32_2.6.32-27+lindi.5_amd64.deb linux-libc-dev_2.6.32-27+lindi.5_amd64.deb linux-headers-2.6.32-5+lindi.5-all-amd64_2.6.32-27+lindi.5_amd64.deb linux-headers-2.6.32-5+lindi.5-all_2.6.32-27+lindi.5_amd64.deb linux-headers-2.6.32-5+lindi.5-common_2.6.32-27+lindi.5_amd64.deb linux-headers-2.6.32-5+lindi.5-amd64_2.6.32-27+lindi.5_amd64.deb linux-image-2.6.32-5+lindi.5-amd64-dbg_2.6.32-27+lindi.5_amd64.deb linux-image-2.6.32-5+lindi.5-amd64_2.6.32-27+lindi.5_amd64.deb linux-base_2.6.32-27+lindi.5_all.deb linux-support-2.6.32-5+lindi.5_2.6.32-27+lindi.5_all.deb which is everything I need but without too much extra. Should I put this to the wiki and replace the old "make -f debian/rules.gen binary-arch_i386_none_686 binary-indep" tricks? Next problem: The unpacked -dbg package takes almost 1.5 GB of disk space. The thought of having to run make menuconfig to manually disable modules that I don't need was scary so I automated the process. This is somewhat hacky but I thought it might be useful to someone: 1) http://iki.fi/lindi/linux/find-config-option-for-module-file takes a path to a kernel module as an argument and prints the CONFIG option that enables it. It needs to be run directory that contains unpacked /usr/src/linux-source-2.6.32.tar.bz2: $ ./find-config-option-for-module-file /lib/modules/2.6.32-5-amd64/kernel/drivers/scsi/device_handler/scsi_dh_rdac.ko CONFIG_SCSI_DH_RDAC $ ./find-config-option-for-module-file /lib/modules/2.6.32-5-amd64/kernel/drivers/memstick/core/mspro_block.ko CONFIG_MSPRO_BLOCK 2) for i in $(find /lib/modules/2.6.32-5-amd64 -name "*.ko"); do echo "$i $(./find-config-option-for-module-file $i)"; done > ../module-to-config.map runs this for all kernel modules and creates mapping from module names to CONFIG options: /lib/modules/2.6.32-5-amd64/kernel/drivers/idle/i7300_idle.ko CONFIG_I7300_IDLE /lib/modules/2.6.32-5-amd64/kernel/drivers/regulator/pcf50633-regulator.ko CONFIG_REGULATOR_PCF50633 /lib/modules/2.6.32-5-amd64/kernel/drivers/regulator/wm831x-ldo.ko CONFIG_REGULATOR_WM831X /lib/modules/2.6.32-5-amd64/kernel/drivers/regulator/wm831x-isink.ko CONFIG_REGULATOR_WM831X /lib/modules/2.6.32-5-amd64/kernel/drivers/regulator/mc13783.ko CONFIG_REGULATOR_MC13783 ... 3) cat module-to-config.map | while read file option; do module=$(basename $file|sed 's/\.ko$//;s/-/_/g'); if [ "$(lsmod|awk '{print $1}'|grep "^$module$")" = "" ]; then echo $option; fi; done > unnecessary-options.lst lists all CONFIG options that are not associated with a module that is currently loaded according to lsmod. 4) for i in $(cat unnecessary-options.lst); do sed -i "s/$i=m/# $i is not set/" $(find debian/config -type f); done edits all the debian/config/** files so that all unnecessary options are disabled. => With all this in place I get nice "almost like official" kernels that have everything I need but take almost no time to build and almost no time to copy over network: 38M Nov 9 12:55 linux-image-2.6.32-5+lindi.5-amd64-dbg_2.6.32-27+lindi.5_amd64.deb 3.8M Nov 9 12:55 linux-headers-2.6.32-5+lindi.5-common_2.6.32-27+lindi.5_amd64.deb 3.4M Nov 9 12:55 linux-image-2.6.32-5+lindi.5-amd64_2.6.32-27+lindi.5_amd64.deb 816K Nov 9 12:56 linux-libc-dev_2.6.32-27+lindi.5_amd64.deb 289K Nov 9 12:55 linux-headers-2.6.32-5+lindi.5-amd64_2.6.32-27+lindi.5_amd64.deb 287K Nov 9 12:56 linux-tools-2.6.32_2.6.32-27+lindi.5_amd64.deb 202K Nov 9 12:56 linux-2.6_2.6.32-27+lindi.5_amd64.build 158K Nov 9 12:55 linux-base_2.6.32-27+lindi.5_all.deb 150K Nov 9 12:55 linux-support-2.6.32-5+lindi.5_2.6.32-27+lindi.5_all.deb 134K Nov 9 12:56 linux-headers-2.6.32-5+lindi.5-all-amd64_2.6.32-27+lindi.5_amd64.deb 134K Nov 9 12:56 linux-headers-2.6.32-5+lindi.5-all_2.6.32-27+lindi.5_amd64.deb 17K Nov 9 12:56 linux-2.6_2.6.32-27+lindi.5_amd64.changes $ debc linux-2.6_2.6.32-27+lindi.5_amd64.changes linux-image-2.6.32-5+lindi.5-amd64|grep ko$ -rw-r--r-- root/root 84136 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/net/bridge/bridge.ko -rw-r--r-- root/root 6144 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/net/802/stp.ko -rw-r--r-- root/root 313968 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/net/sunrpc/sunrpc.ko -rw-r--r-- root/root 18488 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/net/sunrpc/auth_gss/rpcsec_gss_krb5.ko -rw-r--r-- root/root 56440 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko -rw-r--r-- root/root 32512 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/crypto/des_generic.ko -rw-r--r-- root/root 7616 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/crypto/cbc.ko -rw-r--r-- root/root 27048 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/drivers/block/xen-blkfront.ko -rw-r--r-- root/root 30904 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/drivers/block/loop.ko -rw-r--r-- root/root 35792 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/drivers/net/xen-netfront.ko -rw-r--r-- root/root 6976 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/drivers/input/misc/pcspkr.ko -rw-r--r-- root/root 20400 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/drivers/input/evdev.ko -rw-r--r-- root/root 119200 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/drivers/md/dm-mod.ko -rw-r--r-- root/root 104688 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/fs/fuse/fuse.ko -rw-r--r-- root/root 6192 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/fs/nfs_common/nfs_acl.ko -rw-r--r-- root/root 436640 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/fs/nfs/nfs.ko -rw-r--r-- root/root 89480 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/fs/fscache/fscache.ko -rw-r--r-- root/root 15832 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/fs/mbcache.ko -rw-r--r-- root/root 114704 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/fs/lockd/lockd.ko -rw-r--r-- root/root 198416 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/fs/ext3/ext3.ko -rw-r--r-- root/root 85088 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/fs/jbd/jbd.ko -rw-r--r-- root/root 18864 2010-11-09 12:55 ./lib/modules/2.6.32-5+lindi.5-amd64/kernel/fs/binfmt_misc.ko [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=602273 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=580889 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593760 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597828 https://bugzilla.kernel.org/show_bug.cgi?id=20412 (and others) [2] "Problem: In this case, linux-headers-2.6.24-1+foo.1-common will be missing. One needs to invoke the binary-arch_i386 target, which will yield all feature sets (Xen, VServer) and flavours to be generated, and obviously takes a lot longer. See http://lists.debian.org/debian-kernel/2008/04/msg00190.html" [3] diff --git a/debian/config/defines b/debian/config/defines index 24ed9d2..d1fb3be 100644 --- a/debian/config/defines +++ b/debian/config/defines @@ -1,5 +1,5 @@ [abi] -abiname: 5 +abiname: 5+lindi.3 [base] arches: @@ -25,13 +25,13 @@ featuresets: xen [featureset-openvz_base] -enabled: true +enabled: false [featureset-vserver_base] -enabled: true +enabled: false [featureset-xen_base] -enabled: true +enabled: false [description] part-long-xen: This kernel also runs on a Xen hypervisor. diff --git a/debian/rules.real b/debian/rules.real index 506245d..e1230b1 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -51,12 +51,7 @@ ifeq ($(MODULES),True) binary-arch-flavour: install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR) endif -binary-indep: install-doc -binary-indep: install-manual -binary-indep: install-patch -binary-indep: install-source binary-indep: install-support -binary-indep: install-firmware binary-indep: install-linux-base build: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE) -- To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/84fwvaismh....@sauna.l.org