diff --git a/mk_mmc.sh b/mk_mmc.sh index 01d733a..e54ecd3 100755 --- a/mk_mmc.sh +++ b/mk_mmc.sh @@ -510,10 +510,10 @@ function setup_bootscripts { #Setup serial sed -i -e 's:SERIAL:'$SERIAL':g' ${DIR}/scripts/serial.conf - sed -i -e 's:SERIAL:'$SERIAL':g' ${DIR}/scripts/*-tweaks.diff + sed -i -e 's:SERIAL:'$SERIAL':g' ${DIR}/scripts/*.diff #Setup Kernel Boot Address - sed -i -e 's:ZRELADD:'$ZRELADD':g' ${DIR}/scripts/*-tweaks.diff + sed -i -e 's:ZRELADD:'$ZRELADD':g' ${DIR}/scripts/*.diff if [ "$SMSC95XX_MOREMEM" ];then sed -i 's/8192/16384/g' ${DIR}/scripts/*.diff @@ -631,19 +631,23 @@ function initrd_cleanup { function initrd_preseed_settings { echo "NetInstall: Adding Distro Tweaks and Preseed Configuration" + unset UENV + if [ "${USE_UENV}" ] ; then + UENV="-uenv" + fi cd ${TEMPDIR}/initrd-tree/ case "$DIST" in maverick) - patch -p1 < ${DIR}/scripts/ubuntu-tweaks.diff + patch -p1 < ${DIR}/scripts/ubuntu-tweaks${UENV}.diff ;; natty) - patch -p1 < ${DIR}/scripts/ubuntu-tweaks.diff + patch -p1 < ${DIR}/scripts/ubuntu-tweaks${UENV}.diff ;; oneiric) - patch -p1 < ${DIR}/scripts/ubuntu-tweaks.diff + patch -p1 < ${DIR}/scripts/ubuntu-tweaks${UENV}.diff ;; squeeze) - patch -p1 < ${DIR}/scripts/debian-tweaks.diff + patch -p1 < ${DIR}/scripts/debian-tweaks${UENV}.diff ;; esac cd ${DIR}/ @@ -1015,10 +1019,10 @@ function reset_scripts { #Setup serial sed -i -e 's:'$SERIAL':SERIAL:g' ${DIR}/scripts/serial.conf - sed -i -e 's:'$SERIAL':SERIAL:g' ${DIR}/scripts/*-tweaks.diff + sed -i -e 's:'$SERIAL':SERIAL:g' ${DIR}/scripts/*.diff #Setup Kernel Boot Address - sed -i -e 's:'$ZRELADD':ZRELADD:g' ${DIR}/scripts/*-tweaks.diff + sed -i -e 's:'$ZRELADD':ZRELADD:g' ${DIR}/scripts/*.diff if [ "$SMSC95XX_MOREMEM" ];then sed -i 's/16384/8192/g' ${DIR}/scripts/*.diff diff --git a/scripts/debian-tweaks-uenv.diff b/scripts/debian-tweaks-uenv.diff new file mode 100644 index 0000000..f4efec4 --- /dev/null +++ b/scripts/debian-tweaks-uenv.diff @@ -0,0 +1,63 @@ +diff --git a/usr/lib/finish-install.d/08rcn-omap b/usr/lib/finish-install.d/08rcn-omap +new file mode 100755 +index 0000000..6d06fc7 +--- /dev/null ++++ b/usr/lib/finish-install.d/08rcn-omap +@@ -0,0 +1,57 @@ ++#!/bin/sh -e ++cp /etc/e2fsck.conf /target/etc/e2fsck.conf ++ ++if [ -f /etc/rcn.conf ]; then ++ mkdir -p /tmp/mmc ++ mount /dev/mmcblk0p1 /tmp/mmc ++ ++ #Remove NetInstall bits ++ rm -f /tmp/mmc/uInitrd.net || true ++ ++ #Install kernel image deb ++ LD_LIBRARY_PATH=/target/lib /target/usr/bin/dpkg-deb -x /tmp/mmc/linux-image-*_1.0*_armel.deb /target/ ++ rm -f /tmp/mmc/linux-image-*_1.0*_armel.deb || true ++ ++ #Setup Final Boot Scripts ++ if [ -f "/tmp/mmc/boot.scr" ]; then ++ rm -f /tmp/mmc/boot.scr || true ++ mv /tmp/mmc/normal.scr /tmp/mmc/boot.scr ++ fi ++ ++ if [ -f "/tmp/mmc/normal.txt" ]; then ++ FINAL_PART=$(mount | grep /target | grep /dev/ | grep -v devpts | sed 's/ .*//') ++ FINAL_FSTYPE=$(mount | grep /target | grep /dev/ | grep -v devpts | sed 's:'$FINAL_PART' on /target/ type ::' | sed 's/ .*//') ++ sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /tmp/mmc/normal.txt ++ sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /tmp/mmc/normal.txt ++ ++ rm -f /tmp/mmc/uEnv.txt || true ++ mv /tmp/mmc/normal.txt /tmp/mmc/uEnv.txt ++ fi ++ ++ mkdir -p /target/boot/uboot ++ echo "/dev/mmcblk0p1 /boot/uboot auto defaults 0 0" >> /target/etc/fstab ++ ++ #smsc95xx kevent workaround/hack ++ echo "vm.min_free_kbytes = 8192" >> /target/etc/sysctl.conf ++ ++ if [ ! -f /etc/rcn-serial.conf ]; then ++ cat /target/etc/inittab | grep SERIAL || echo "S:2345:respawn:/sbin/getty 115200 SERIAL" >> /target/etc/inittab ++ fi ++ ++ cp -r /lib/firmware/ /target/lib/ || true ++ ++ rm -f /etc/rcn.conf ++ ++ #Generate new initrd.img-* ++ mount -o bind /sys /target/sys ++ chroot /target update-initramfs -c -k `uname -r` ++ chroot /target mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-`uname -r` /boot/uInitrd ++ cp /target/boot/uInitrd /tmp/mmc/uInitrd ++ chroot /target mkimage -A arm -O linux -T kernel -C none -a ZRELADD -e ZRELADD -n `uname -r` -d /boot/vmlinuz-`uname -r` /boot/uImage ++ cp /target/boot/uImage /tmp/mmc/uImage ++ umount /target/sys ++ ++ sync ++ umount /tmp/mmc ++fi ++ diff --git a/scripts/debian-tweaks.diff b/scripts/debian-tweaks.diff index f9e45f2..8234ad9 100644 --- a/scripts/debian-tweaks.diff +++ b/scripts/debian-tweaks.diff @@ -7,7 +7,7 @@ index 0000000..6d06fc7 +#!/bin/sh -e +cp /etc/e2fsck.conf /target/etc/e2fsck.conf + -+if [ -e /etc/rcn.conf ]; then ++if [ -f /etc/rcn.conf ]; then + mkdir -p /tmp/mmc + mount /dev/mmcblk0p1 /tmp/mmc + @@ -19,7 +19,7 @@ index 0000000..6d06fc7 + rm -f /tmp/mmc/linux-image-*_1.0*_armel.deb || true + + #Setup Final Boot Scripts -+ if [ -e "/tmp/mmc/boot.scr" ]; then ++ if [ -f "/tmp/mmc/boot.scr" ]; then + rm -f /tmp/mmc/boot.scr || true + mv /tmp/mmc/normal.scr /tmp/mmc/boot.scr + fi @@ -30,7 +30,7 @@ index 0000000..6d06fc7 + #smsc95xx kevent workaround/hack + echo "vm.min_free_kbytes = 8192" >> /target/etc/sysctl.conf + -+ if [ ! -e /etc/rcn-serial.conf ]; then ++ if [ ! -f /etc/rcn-serial.conf ]; then + cat /target/etc/inittab | grep SERIAL || echo "S:2345:respawn:/sbin/getty 115200 SERIAL" >> /target/etc/inittab + fi + diff --git a/scripts/ubuntu-tweaks-uenv.diff b/scripts/ubuntu-tweaks-uenv.diff new file mode 100644 index 0000000..303db4b --- /dev/null +++ b/scripts/ubuntu-tweaks-uenv.diff @@ -0,0 +1,83 @@ +diff --git a/usr/lib/finish-install.d/08rcn-omap b/usr/lib/finish-install.d/08rcn-omap +new file mode 100755 +index 0000000..6d06fc7 +--- /dev/null ++++ b/usr/lib/finish-install.d/08rcn-omap +@@ -0,0 +1,76 @@ ++#!/bin/sh -e ++cp /etc/flash-kernel.conf /target/etc/flash-kernel.conf ++cp /etc/SERIAL.conf /target/etc/init/SERIAL.conf ++ ++if [ -f /etc/rcn.conf ]; then ++ mkdir -p /tmp/mmc ++ mount /dev/mmcblk0p1 /tmp/mmc ++ ++ #Remove NetInstall bits ++ rm -f /tmp/mmc/uInitrd.net || true ++ ++ #Cleanup Ubuntu's mess ++ rm -f /tmp/mmc/uInitrd || true ++ rm -f /tmp/mmc/uInitrd.bak || true ++ rm -f /tmp/mmc/uImage || true ++ rm -f /tmp/mmc/uImage.bak || true ++ ++ if [ -f "/tmp/mmc/boot.scr.bak" ]; then ++ rm -f /tmp/mmc/boot.scr.bak || true ++ fi ++ ++ if [ -f "/tmp/mmc/MLO.bak" ]; then ++ rm -f /tmp/mmc/MLO || true ++ mv /tmp/mmc/MLO.bak /tmp/mmc/MLO ++ fi ++ ++ if [ -f "/tmp/mmc/u-boot.bin.bak" ]; then ++ rm -f /tmp/mmc/u-boot.bin || true ++ mv /tmp/mmc/u-boot.bin.bak /tmp/mmc/u-boot.bin ++ fi ++ ++ #Install kernel image deb ++ LD_LIBRARY_PATH=/target/lib /target/usr/bin/dpkg-deb -x /tmp/mmc/linux-image-*_1.0*_armel.deb /target/ ++ rm -f /tmp/mmc/linux-image-*_1.0*_armel.deb || true ++ ++ #With Oneiric Updates, these now seem to ignore /etc/flash-kernel.conf, so lets just remove them.. ++ chroot /target apt-get remove -y linux-image-omap* || true ++ chroot /target apt-get remove -y linux-headers-omap* || true ++ chroot /target apt-get remove -y u-boot-linaro* || true ++ chroot /target apt-get remove -y x-loader-omap* || true ++ ++ chroot /target apt-get remove -y flash-kernel || true ++ ++ #Setup Final Boot Scripts ++ if [ -f "/tmp/mmc/normal.txt" ]; then ++ FINAL_PART=$(mount | grep /target | grep /dev/ | grep -v devpts | sed 's/ .*//') ++ FINAL_FSTYPE=$(mount | grep /target | grep /dev/ | grep -v devpts | sed 's:'$FINAL_PART' on /target/ type ::' | sed 's/ .*//') ++ sed -i -e 's:FINAL_PART:'$FINAL_PART':g' /tmp/mmc/normal.txt ++ sed -i -e 's:FINAL_FSTYPE:'$FINAL_FSTYPE':g' /tmp/mmc/normal.txt ++ ++ rm -f /tmp/mmc/uEnv.txt || true ++ mv /tmp/mmc/normal.txt /tmp/mmc/uEnv.txt ++ fi ++ ++ mkdir -p /target/boot/uboot ++ echo "/dev/mmcblk0p1 /boot/uboot auto defaults 0 0" >> /target/etc/fstab ++ ++ #smsc95xx kevent workaround/hack ++ echo "vm.min_free_kbytes = 8192" >> /target/etc/sysctl.conf ++ ++ cp -r /lib/firmware/ /target/lib/ || true ++ ++ rm -f /etc/rcn.conf ++ ++ #Generate new initrd.img-* ++ mount -o bind /sys /target/sys ++ chroot /target update-initramfs -c -k `uname -r` ++ chroot /target mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d /boot/initrd.img-`uname -r` /boot/uInitrd ++ cp /target/boot/uInitrd /tmp/mmc/uInitrd ++ chroot /target mkimage -A arm -O linux -T kernel -C none -a ZRELADD -e ZRELADD -n `uname -r` -d /boot/vmlinuz-`uname -r` /boot/uImage ++ cp /target/boot/uImage /tmp/mmc/uImage ++ umount /target/sys ++ ++ sync ++ umount /tmp/mmc ++fi ++ diff --git a/scripts/ubuntu-tweaks.diff b/scripts/ubuntu-tweaks.diff index e5ef60f..bd44bed 100644 --- a/scripts/ubuntu-tweaks.diff +++ b/scripts/ubuntu-tweaks.diff @@ -8,7 +8,7 @@ index 0000000..6d06fc7 +cp /etc/flash-kernel.conf /target/etc/flash-kernel.conf +cp /etc/SERIAL.conf /target/etc/init/SERIAL.conf + -+if [ -e /etc/rcn.conf ]; then ++if [ -f /etc/rcn.conf ]; then + mkdir -p /tmp/mmc + mount /dev/mmcblk0p1 /tmp/mmc + @@ -21,16 +21,16 @@ index 0000000..6d06fc7 + rm -f /tmp/mmc/uImage || true + rm -f /tmp/mmc/uImage.bak || true + -+ if [ -e "/tmp/mmc/boot.scr.bak" ]; then ++ if [ -f "/tmp/mmc/boot.scr.bak" ]; then + rm -f /tmp/mmc/boot.scr.bak || true + fi + -+ if [ -e "/tmp/mmc/MLO.bak" ]; then ++ if [ -f "/tmp/mmc/MLO.bak" ]; then + rm -f /tmp/mmc/MLO || true + mv /tmp/mmc/MLO.bak /tmp/mmc/MLO + fi + -+ if [ -e "/tmp/mmc/u-boot.bin.bak" ]; then ++ if [ -f "/tmp/mmc/u-boot.bin.bak" ]; then + rm -f /tmp/mmc/u-boot.bin || true + mv /tmp/mmc/u-boot.bin.bak /tmp/mmc/u-boot.bin + fi @@ -48,7 +48,7 @@ index 0000000..6d06fc7 + chroot /target apt-get remove -y flash-kernel || true + + #Setup Final Boot Scripts -+ if [ -e "/tmp/mmc/boot.scr" ]; then ++ if [ -f "/tmp/mmc/boot.scr" ]; then + rm -f /tmp/mmc/boot.scr || true + mv /tmp/mmc/normal.scr /tmp/mmc/boot.scr + fi