|
Warning: this is a htmlized version!
The original is across this link. |
#######
#
# E-scripts on building the kernel and some related things.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/a/e/kernel.e>
# or at <http://angg.twu.net/e/kernel.e.html>.
# See also <http://angg.twu.net/emacs.html>,
# <http://angg.twu.net/a/.emacs[.html]>,
# <http://angg.twu.net/a/.zshrc[.html]>,
# <http://angg.twu.net/escripts.html>,
# and <http://angg.twu.net/>.
#
#######
##########
#
# kernel 2.0.37
#
##########
# status: ok 99jun16
# «compile20»
k=angg
# k=lea
kconf=~/k20xxconf-$k
kconfsnd=~/k20xxconf-$k.snd
rm -Rv /usr/src/linux-2.0/
rm /usr/src/linux
cd /usr/src/
# tar -xvzf $S/http/www.kernel.org/pub/linux/kernel/v2.0/linux-2.0.35.tar.gz
tar -xvzf /big/slinks1/dists/slink/main/source/devel/kernel-source-2.0.35_2.0.35.orig.tar.gz
for i in v2.0/patch-2.0.36.gz \
v2.0/patch-2.0.37.gz \
v2.0/patch-2.0.38.gz; do
echo "\n $i:"
gzip -cd $S/http/www.kernel.org/pub/linux/kernel/$i | patch -p0
done |& tee linux/op
mv linux linux-2.0
ln -s linux-2.0 linux
# (find-fline "~/k20xxconf-angg")
# (find-fline "~/k20xxconf-angg.snd")
cd /usr/src/linux-2.0/
sleep 2
echo -n > .config-start
sleep 2
# cp -iv ~/.config20xx .config
cp -v $kconf .config
cp -v $kconfsnd /etc/soundconf
# rm -fv /etc/soundconf
# (find-fline "/etc/soundconf")
# cp -iv /etc/soundconf $kconfsnd
cd /usr/src/linux-2.0/
make symlinks
( # The script may ask this:
# "Old configuration exists in `/etc/soundconf'. Use it [Y/n/?]"
MAKE=make \
bash scripts/Configure -d arch/i386/config.in |& tee omc
)
find .* * -anewer .config-start > .files.config
# agrep '\-C' $(cat .files.config)
#cp -v .config $kconf
#cp -iv /etc/soundconf $kconfsnd
make depend |& tee omd
sleep 2
echo -n > .mkzImage-start
sleep 2
# Use the version with -g if you want debug symbols.
# (find-k2file "Makefile" 90)
#
#make CFLAGS='-g -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strength-reduce' zImage |& tee omz
make zImage |& tee omz
sleep 2
echo -n > .mkmodules-start
sleep 2
#
make modules |& tee omm
# Now we use the timestamps to
# index only the interesting files.
#
find * -name '*.[chS]' -and -anewer .mkzImage-start > .files.chS.used
find * -name '*.[chS]' -and -not -anewer .mkzImage-start > .files.chS.unused
etags `cat .files.chS.used`
glimpseindex -H . -F < .files.chS.used
ln -sf /usr/src/linux-2.0/System.map /boot/System.map-2.0.38
# (find-k2file "drivers/sound/configure.c" ".soundconf")
# (find-k2file "drivers/sound/configure.c" "oldconf")
# (find-k2file "drivers/sound/Makefile" "oldconfig")
k=angg
rm -Rv /boot/$k
mkdir /boot/$k
cd /usr/src/linux-2.0/
cp -iv .config /boot/$k/k20conf
cp -iv modules/* /boot/$k
cp -iv arch/i386/boot/zImage /boot/$k/k2038
gzip -cd /usr/lib/loadlin/loadlin.exe.gz > /boot/$k/loadlin.exe
cd /boot/$k
zip -9 /root/k$k.zip *
# «gdb20»
#
# (gdb "gdb /usr/src/linux-2.0/vmlinux /proc/kcore")
# (find-fline "~/latte/.gdbinit")
# (gdb "gdb -cd=/home/root/latte -d /usr/src/latte-1.1/ -x /home/root/latte/.gdbinit")
# Obsolete notes:
# **
# This a hack to TRY to get around a strange bug...
# (find-k2file "drivers/net/Makefile" "autoconf.h")
# (find-k2file "omz" "autoconf.h")
# (find-k2file "scripts/Configure" "autoconf.h")
mv .tmpconfig .config
mv .tmpconfig.h include/linux/autoconf.h
# **
################
#
# Kernel 2.2.10
# 99may15
#
################
# «compile22»
k=angg22
# k=lea
# (find-fline "$S/http/www.br.kernel.org/pub/linux/kernel/v2.2/")
rm -Rv /usr/src/linux-2.2/
rm /usr/src/linux
cd /usr/src/
# tar -xvzf /big/slinks2/kernel2.2/linux-2.2.3.tar.gz
tar -xvzf /big/slinks1/dists/slink/main/source/devel/kernel-source-2.2.1_2.2.1.orig.tar.gz
for i in v2.2/patch-2.2.2.gz \
v2.2/patch-2.2.3.gz \
v2.2/patch-2.2.4.gz \
v2.2/patch-2.2.5.gz \
v2.2/patch-2.2.6.gz \
v2.2/patch-2.2.7.gz \
v2.2/patch-2.2.8.gz \
v2.2/patch-2.2.9.gz \
v2.2/patch-2.2.10.gz \
v2.2/patch-2.2.11.gz \
v2.2/patch-2.2.12.gz; do
echo " $i:"
gzip -cd /snarf/http/www.kernel.org/pub/linux/kernel/$i | patch -p0
done |& tee linux/op
mv linux linux-2.2
ln -s linux-2.2 linux
cd /usr/src/linux-2.2/
cp ~/k22conf .config
make oldconfig |& tee omo
# (find-k22file "~/k22conf")
# (find-k22file "omo")
# make config
# make menuconfig
# (find-k22file "scripts/kconfig.tk")
# (find-k22file "Documentation/Configure.help")
make xconfig |& tee omx
# tkdiff .config ~/k22conf
# cp .config ~/k22conf
make depend |& tee omd
sleep 2
echo -n > .mkzImage-start
sleep 2
# Use the line with -g if you want debug symbols.
# (find-k2file "Makefile" 90)
#
# make CFLAGS='-g -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strength-reduce' bzImage |& tee omz
nice \
make bzImage |& tee omz
sleep 2
echo -n > .mkmodules-start
sleep 2
#
make modules |& tee omm
# Now we use the timestamps to
# index only the interesting files.
#
find * -name '*.[chS]' -and -anewer .mkzImage-start > .files.chS.used
find * -name '*.[chS]' -and -not -anewer .mkzImage-start > .files.chS.unused
etags `cat .files.chS.used`
glimpseindex -H . -F < .files.chS.used
find * -type f > .files
grep -i make < .files > .files.m
# This gives a good speedup if using -g.
#echo 'quit' | gdb -m vmlinux /proc/kcore
# Oops - seems to be broken on slink's gdb.
# (gdb "gdb /usr/src/linux-2.0/vmlinux /proc/kcore")
# (find-node "(gdb)File Options" "`-m'")
k=angg22
rm -Rv /boot/$k
mkdir /boot/$k
cd /usr/src/linux-2.2/
cp -iv .config /boot/$k/kconfig
cp -iv modules/* /boot/$k
cp -iv arch/i386/boot/bzImage /boot/$k/k22xx
laf /boot/$k
# (find-es "floppy" "syslinux")
#######
#
# www.br.kernel.com
#
#######
lynx /snarf/http/www.kernel.org/mirrors/
# http://www.br.kernel.org/pub/linux/
# ftp://ftp.br.kernel.org/pub/linux/
#######
#
# downloading new kernel versions
#
#######
psne http://www.kernel.org/mirrors/
lynx /snarf/http/www.kernel.org/mirrors/
cd $S/http/www.br.kernel.org/pub/linux/kernel/
find v2.0 v2.2
psne http://www.br.kernel.org/pub/linux/kernel/v2.0/
psne http://www.ca.kernel.org/pub/linux/kernel/v2.1/
psne http://www.br.kernel.org/pub/linux/kernel/v2.2/
psne http://www.br.kernel.org/pub/linux/kernel/v2.0/patch-2.0.36.gz
psne http://www.br.kernel.org/pub/linux/kernel/v2.0/patch-2.0.37.gz
psne http://www.br.kernel.org/pub/linux/kernel/v2.0/patch-2.0.38.gz
psne http://www.br.kernel.org/pub/linux/kernel/v2.2/patch-2.2.10.gz
psne http://www.br.kernel.org/pub/linux/kernel/v2.2/patch-2.2.11.gz
psne http://www.br.kernel.org/pub/linux/kernel/v2.2/patch-2.2.12.gz
psne http://www.br.kernel.org/pub/linux/kernel/v2.2/patch-2.2.13.gz
mkdir -p /snarf/http/www.br.kernel.org/pub/linux/kernel/v2.1/
cd /snarf/http/www.br.kernel.org/pub/linux/kernel/v2.1/
for i in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20; do
psne $FBOTO_H/linux-2.2.0-pre8.tar.bz2$i.gz
done
#
# Armada keyboard patch:
# (I'm not using it anymore)
cd /usr/src/linux/drivers/char/
patch keyboard.c \
/snarf/http/www.kabel.de/~hmueller/armada11xx/armada11xx_apm.patch
#########
#
# pcsndrv 1.2
#
#########
# (find-k2file "drivers/pcsnd/README")
# (find-k2file "drivers/pcsnd/pcspinstall")
# (find-fline "/dev/MAKEDEV" "audio)")
insmod /usr/src/linux/modules/pcsnd.o
cd /dev/
mknod -m 666 pcmixer c 13 0
mknod -m 666 pcsp c 13 3
mknod -m 666 pcaudio c 13 4
mknod -m 666 pcsp16 c 13 5
rm -v mixer dsp audio dsp16
ln -s pcmixer mixer
ln -s pcsp dsp
ln -s pcaudio audio
ln -s pcsp16 dsp16
rm -Rv /usr/src/pcsnd-kit/
cd /usr/src/
tar -xvzf /snarf/ftp/ftp.informatik.hu-berlin.de/pub/os/linux/hu-sound/pcsndrv-1.2.tgz pcsnd-kit/'*'
cd /usr/src/pcsnd-kit/
make |& tee om
# (find-fline "/usr/src/pcsnd-kit/Readme")
# (find-fline "/usr/src/pcsnd-kit/")
######
#
# kernel-package
# 99nov14
#
######
apti kernel-package
# (find-vldifile "kernel-package.list")
# (find-fline "/usr/doc/kernel-package/")
# (find-fline "/usr/lib/kernel-package/README" "impatient:")
# (find-fline "/etc/kernel-pkg.conf")
# (find-fline "/usr/sbin/kernel-packageconfig")
# (find-fline "/usr/sbin/make-kpkg")
# (find-fline "/usr/lib/kernel-package/")
# (find-fline "/usr/doc/libc-kheaders/debian.README.gz")
man kernel-pkg.conf
man make-kpkg
man kernel-packageconfig
# I'm just starting to ressurect this chunk, there's nothing really
# working here...
lynx $S/http/www.geocities.com/ResearchTriangle/3328/paper/Debian-is-Da-BOMB-53.html
cd /usr/local/src/kernels/2.2.6
pgp linux-2.2.6.tar.bz2.sign (to check the pgp signature)
tar xIvf linux-2.2.6.tar.bz2
(apply alan cox patches if appropriate:
mv linux linux.ac
bzip2 -cd patch-2.2.6-ac2.bz2 | patch -p0 :)
cd linux (or linux.ac)
make menuconfig (and season to taste, and then save the recipe to
.config)
Then the magic begins:
make-kpkg clean && make-kpkg --revision=42:custom.1.0 kernel_image &&
make-kpkg --revision=42:custom.1.0 kernel_headers
Then if all goes well, you will have two new *.deb package in the ../
directory... now install them:
cd ..
dpkg --install kernel-image-2.2.6-ac2-i686.deb
dpkg --install kernel-headers-2.2.6-ac2-i686.deb
# On modules and sound:
lynx $S/http/www.debian.org/Lists-Archives/debian-user-9905/msg00138.html
# (find-vldifile "kernel-package.list")
# (find-fline "/usr/doc/kernel-package/")
# (find-fline "/usr/doc/kernel-package/README.gz")
######
#
# gdb'ing the kernel
#
######
# (gdb "gdb /usr/src/linux-2.0/vmlinux /proc/kcore")
# (find-k2file ".files.chS.used")
# (find-k2file "kernel/module.c")
# (find-k2file "kernel/info.c")
# (eeman "2 intro")
# (eeman "2 syscalls")
# (find-k2tag "__NR__newselect")
# (find-k2tag "sys_open")
# (eeman "5 proc")
# (find-k2file "fs/proc/")
# (find-k2file "fs/proc/root.c" "\"modules\"")
# (find-k2file "fs/proc/array.c" "PROC_MODULES:")
# (find-k2tag "get_module_list")
# (find-k2tag "printk")
# (find-k2file "kernel/printk.c" "int printk")
ptype kernel_module
set var $x=kernel_module
define xn
set var $x=$x->next
p *$x
end
#####
#
# /proc/xxx/statm
# 99nov??
#
#####
# (eeman "5 proc" "maps *A file containing")
# (find-k22file "")
# (find-k22file ".files.chS.used")
# Prepare the ".strings" file
# This is *SLOW*, as getstrings is a perl script
# «.strings»
#
cd /usr/src/linux-2.2/
for i in $(<.files.chS.used); do
echo "\nħħħħ$i:"; getstrings < $i
done | tee .strings
# (find-k22file ".strings" "statm")
# (find-k22file "fs/proc/base.c" "statm")
# (find-k22tag "proc_dir_entry")
# (find-k22tag "proc_pid_fill_inode")
# (find-k22file "fs/proc/array.c" "proc_array_inode_operations")
# (find-k22file "fs/proc/array.c" "proc_array_operations")
# (find-k22file "fs/proc/array.c" "array_read")
# (find-k22file "fs/proc/array.c" "case PROC_PID_STAT")
# (find-k22file "fs/proc/array.c" "get_process_array")
# (find-k22file "fs/proc/array.c" "get_stat(")
# (find-k22file "fs/proc/array.c" "get_statm(")
P=$(cd /proc; print -l [0-9]* | sort -n) \
expect -c '
foreach pid $env(P) {
catch {
foreach {size res sha txt lib sta drt} [exec cat /proc/$pid/statm] {}
puts [format "%s:: size: %s resident: %s share: %s
text: %s library: %s stack: %s dirty: %s" \
$pid $size $res $sha $txt $lib $sta $drt]
}
}
'
# Much better:
P=$(cd /proc; print -l [0-9]* | sort -n) \
expect -c '
foreach pid $env(P) {
catch {
foreach v {siz res sha txt lib sta drt} \
n "[exec cat /proc/$pid/statm]" {
set $v [format "%3s" $n]
}
set pid [format "%4s" $pid]
puts "pid:$pid siz:$siz res:$res sha:$sha txt:$txt lib:$lib sta:$sta drt:$drt"
}
}
'