[5295629.397667] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5295632.397621] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5295695.401578] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5295697.401704] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5295762.405584] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5295763.405672] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5295827.409421] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5295828.409475] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5295891.413175] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5295892.413244] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5295957.417238] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5295958.417222] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5296019.421239] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun0
[5296021.421461] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5296022.421032] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5296037.421941] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun0
[5296086.424835] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5296086.425506] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5296150.428703] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5296151.428707] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5296214.432342] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5296216.432417] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5296280.436495] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5296280.437737] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5296408.443693] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5296410.444089] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5296677.460567] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun0
[5296679.460401] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun0
[5297073.484089] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun0
[5303950.892631] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5304016.896475] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5304080.900445] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5304144.904197] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5304208.907984] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5304273.911929] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5304338.917332] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5305487.878870] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5305585.360395] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5305609.174829] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun2
[5306267.030679] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5306267.030700] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun2
[5306267.030737] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun2
[5306350.035701] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5306356.035917] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5311925.366478] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5311990.370358] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5312054.374231] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5312121.378024] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5312186.381923] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5312253.385986] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5312320.389935] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5312384.393791] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5312462.398435] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun2
[5312495.400431] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun2
[5313547.463161] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5313548.463244] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun2
[5313549.463272] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun2
[5313613.467197] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5313765.476231] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5313768.476437] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun2
[5313768.476460] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun2
[5313831.480047] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5313838.482035] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5313898.484152] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5313903.484481] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun2
[5313903.484504] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun2
[5313962.488045] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5314017.491017] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5314018.491198] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5314019.491211] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun2
[5314020.491309] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun2
[5314081.495078] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5314145.498958] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5314147.499048] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun2
[5314152.499377] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5314152.499400] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5314152.499522] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun2
[5314155.499559] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun2
[5314314.508956] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5314375.512694] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5314379.512922] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun2
[5314379.512946] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun2
[5314383.513131] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5314435.516249] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5314435.516272] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5314436.516222] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun2
[5314437.516223] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun2
[5314499.520189] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5314503.520314] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5314554.523268] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5314554.523288] IPv4: martian source 29.250.35.251 from 192.168.1.3, on dev tun2
[5314557.523310] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5314557.523330] IPv4: martian source 185.121.25.242 from 192.168.1.3, on dev tun2
[5314621.527322] IPv4: martian source 85.199.214.102 from 192.168.1.3, on dev tun2
[5314623.527383] IPv4: martian source 213.138.110.176 from 192.168.1.3, on dev tun2
[5325641.940801] x_tables: ip_tables: DNAT target: used from hooks POSTROUTING, but only usable from PREROUTING/OUTPUT
[5326136.225642] x_tables: ip_tables: DNAT target: only valid in nat table, not filter
[5326269.186266] x_tables: ip_tables: DNAT target: used from hooks POSTROUTING, but only usable from PREROUTING/OUTPUT
[5327086.000591] x_tables: ip_tables: MASQUERADE target: used from hooks OUTPUT, but only usable from POSTROUTING
[5394062.928229] TCP: request_sock_TCP: Possible SYN flooding on port 3128. Sending cookies. Check SNMP counters.

RANDOM FORTUNE:

Love's Drug My love is like an iron wand That conks me on the head, My love is like the valium That I take before my bed, My love is like the pint of scotch That I drink when I be dry; And I shall love thee still, my dear, Until my wife is wise.

Kernel Packaging

Note: This tutorial assumes that you know how to compile a kernel already. It only looks at a way of creating a package and doesn't aim to show kernel config options.

Note 2: We won't be using the stock Slackware kernel SlackBuilds.

Kernel Output Target Option

The usual way to make any sort of package is via the $DESTDIR variable. The kernel doesn't use this however, but it does have an O switch which does almost the same thing, although the output might not be exactly what you expect. I will not be using that option here.

Building

Copy your .config into the source directory and do

make menuconfig

(or whichever method you prefer.) You may need to do make mrproper first, and perhaps make oldconfig.

make

Note: Do not use make install or make modules_install, even with O switch, as this will install to /boot and /lib/modules, which we don't want.

At this point everything we need is in the source directory. The file modules.order lists the modules to be installed and we can use that to help us make a package.

Installing Modules and Kernel to our Package Directory

Ok let's use /tmp/kernel-package for our package directory. Also let's assume a 2.6.29.6 kernel with jabberwok as local name. A little bash will copy our modules to it:

LIBSDIR=/tmp/kernel-package/lib/modules/2.6.29.6-jabberwok/kernel

for i in $(sed "s#^kernel/##" modules.order)
do
  mkdir -p $LIBSDIR/$(dirname $i)
  install -m 644 -v $i $LIBSDIR/$(dirname $i)
done

Now we need the kernel and associated files.

mkdir /tmp/kernel-package/boot
cp arch/x86/boot/bzImage /tmp/kernel-package/boot/vmlinuz-2.6.29.6-jabberwok
cp System.map /tmp/kernel-package/boot/System.map-2.6.29.6-jabberwok
cp .config /tmp/kernel-package/boot/config-2.6.29.6-jabberwok
mkdir /tmp/kernel-package/install

doinst.sh:

## Taken from stock modules package
if [ -x sbin/depmod ]; then
  chroot . /sbin/depmod -a 2.6.29.6-jabberwok > /dev/null 2> /dev/null
fi

(cd lib/modules/2.6.29.6-jabberwok ; rm -rf build)
(cd lib/modules/2.6.29.6-jabberwok ; ln -sf /usr/src/linux-2.6.29.6-jabberwok build)
(cd lib/modules/2.6.29.6-jabberwok ; rm -rf source)
(cd lib/modules/2.6.29.6-jabberwok ; ln -sf /usr/src/linux-2.6.29.6-jabberwok source)

slack-desc:

# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

kernel-jabberwok|-----handy-ruler------------------------------------------------------|
kernel-jabberwok: kernel and modules for kernel-jabberwok 2.6.29.6
kernel-jabberwok:
kernel-jabberwok: Jabberwokky type kernel!
kernel-jabberwok:
kernel-jabberwok:
kernel-jabberwok:
kernel-jabberwok:
kernel-jabberwok:
kernel-jabberwok:
kernel-jabberwok:
kernel-jabberwok:

They should both be copied to the install directory.

Making the Package

cd /tmp/kernel-package
/sbin/makepkg -l y -c n /tmp/kernel-jabberwok-2.6.29.6-i686-1_tag.txz

Change '_tag' to your usual moniker. Hopefully we now have a package in /tmp. Copy it to a temporary directory somewhere, explodepkg it and check the contents. We don't want to install something with messed up paths etc. If all is well we can installpkg it.

As usual, edit your /etc/lilo.conf and add an option for the new kernel, keeping the old kernel entry in place for safety, then run lilo.

A Little Automation

Of course this would be easier to control with a script rather than typing in these commands manually and trying not to make typos. Here is the script that I've been using (run make menuconfig first):

kernel.SlackBuild

Notes:

You should have a /usr/src/linux-$VERSION-$LOCALNAME on your target box or you may have problems later if compiling anything that needs that source.

Do not omit setting localname in .config.

Conclusion

The aim for doing this was to be able to build a kernel for my old T42 on my desktop box using the T42's .config. It could be possible to split up kernel and modules into separate packages (howto for that coming soon). Note that this does not include the firmware so you should keep the relevant kernel-firmware package installed.

At the end of the day, this helped me to compile a kernel without my laptop getting even warm, which was the point of the project.