summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Loibl <andreas@andreas-loibl.de>2012-02-26 21:03:49 +0100
committerAndreas Loibl <andreas@andreas-loibl.de>2012-02-26 21:03:49 +0100
commit939eb5986f97e2c9d5a8b69e957fd2170aa80f1e (patch)
tree185b22570b09d6c9098d41e7d9a0eca5299afd97
parent3d8fe6ec91beace032d0e2b29372181a59fb77a9 (diff)
downloadkanotix-939eb5986f97e2c9d5a8b69e957fd2170aa80f1e.zip
kanotix-939eb5986f97e2c9d5a8b69e957fd2170aa80f1e.tar.gz
added support to build gfxoverlay with chroot-kernel different from host-kernel
-rwxr-xr-xbuild_gfxoverlay.sh51
1 files changed, 39 insertions, 12 deletions
diff --git a/build_gfxoverlay.sh b/build_gfxoverlay.sh
index 6b8632d..40fe4e8 100755
--- a/build_gfxoverlay.sh
+++ b/build_gfxoverlay.sh
@@ -42,6 +42,42 @@ mount --bind /proc proc/
mount --bind /sys sys/
mount --bind /dev dev/
cp /etc/resolv.conf etc/resolv.conf
+mv bin/uname bin/uname.real
+cat <<"eof" > bin/uname
+#!/bin/sh
+[ -z "$1" ] && uname.real && exit
+m=$(file /bin/true | grep -q 'ELF 64-bit' && echo x86_64 || echo x86)
+r=$(basename "$(ls /lib/modules|head -n1)")
+( while [ "$1" ]; do
+case $1 in
+-m) echo $m;;
+-r) echo $r;;
+-a)
+ echo $(uname.real -s -n) $r $(uname.real -v) $m
+ p=$(uname.real -p)
+ i=$(uname.real -i)
+ [ "$p" = "unknown" ] || echo $p
+ [ "$i" = "unknown" ] || echo $n
+ uname.real -o
+ ;;
+*)
+ uname.real $1
+ ;;
+esac; shift; done ) | tr '\n' ' ' | sed 's/ $/\n/'
+eof
+chmod +x bin/uname
+mv sbin/modinfo sbin/modinfo.real
+cat <<"eof" > sbin/modinfo
+#!/bin/sh
+if echo "$@" | grep -qw -- -k; then
+modinfo.real "$@"
+exit $?
+else
+modinfo.real -k $(uname -r) "$@"
+exit $?
+fi
+eof
+chmod +x sbin/modinfo
cat <<"eof" > usr/sbin/update-initramfs
#!/bin/sh
echo "update-initramfs is disabled for overlay-build"
@@ -52,18 +88,6 @@ cat <<"eof" > overlay.sh
export LC_ALL=C LANG= DISPLAY=
-uname()
-{
-case $1 in
--m)
- file /bin/true | grep -q 'ELF 64-bit' && echo x86_64 || echo x86
- ;;
--r)
- basename /lib/modules/*
- ;;
-esac
-}
-
eof
cat usr/local/bin/install-$drv-debian.sh >> overlay.sh
sed -i '/exit 3/d' overlay.sh
@@ -87,6 +111,9 @@ if [ -z "$(find overlay/ -name '*.ko')" ]; then
fi
cd overlay
rm -rf usr/sbin/update-initramfs etc/resolv.conf usr/src/NVIDIA-Linux* usr/src/ati-driver-installer* overlay.sh tmp var/log .??*
+rm bin/uname sbin/modinfo
+mv bin/uname.real bin/uname
+mv sbin/modinfo.real sbin/modinfo
rm -f etc/X11/xorg.conf.1st
printf 'Section "Device"\n Identifier "Device0"\n Driver "'"$drv"'"\nEndSection\n' > etc/X11/xorg.conf
cd ..