Add lilo package for use in making bootable images for x86
authorGerry Rozema <groz@openwrt.org>
Thu, 17 Aug 2006 07:37:54 +0000 (07:37 +0000)
committerGerry Rozema <groz@openwrt.org>
Thu, 17 Aug 2006 07:37:54 +0000 (07:37 +0000)
SVN-Revision: 4582

utils/lilo/Makefile [new file with mode: 0755]
utils/lilo/S11Pivot [new file with mode: 0755]
utils/lilo/bdlilo.conf [new file with mode: 0755]
utils/lilo/boot.msg [new file with mode: 0755]
utils/lilo/lilo.conf [new file with mode: 0755]
utils/lilo/mkbootable [new file with mode: 0755]

diff --git a/utils/lilo/Makefile b/utils/lilo/Makefile
new file mode 100755 (executable)
index 0000000..88f16ab
--- /dev/null
@@ -0,0 +1,50 @@
+# 
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id: Makefile 4091 2006-06-27 00:35:46Z mbm $
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=lilo
+PKG_VERSION:=22.7.2
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.gz
+PKG_SOURCE_URL:=ftp://metalab.unc.edu/pub/Linux/system/boot/lilo/
+PKG_MD5SUM:=
+PKG_CAT:=zcat
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lilo
+SECTION:=base
+CATEGORY:=X86 Boot Images
+TITLE:=lilo
+DESCRIPTION:=lilo
+URL:=ftp://metalab.unc.edu/pub/Linux/system/boot/lilo/
+DEPENDS:=@LINUX_2_6_X86||LINUX_2_4_X86
+endef
+
+
+
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) alles
+       $(STRIP) $(PKG_BUILD_DIR)/lilo.static
+endef
+
+define Package/lilo/install
+       mkdir -p $(1)/sbin
+       mkdir -p $(1)/etc/init.d
+       mkdir -p $(1)/boot
+       $(CP) $(PKG_BUILD_DIR)/lilo.static $(1)/sbin/lilo
+       $(CP) lilo.conf $(1)/etc
+       $(CP) boot.msg $(1)/etc
+       $(CP) S11Pivot $(1)/etc/init.d
+endef
+
+$(eval $(call BuildPackage,lilo))
diff --git a/utils/lilo/S11Pivot b/utils/lilo/S11Pivot
new file mode 100755 (executable)
index 0000000..6962b6d
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Copyright (C) 2006 OpenWrt.org
+
+#pivot function blatantly stolen from the firstboot stuff in the WRT54 arch files
+pivot() { # <new_root> <old_root>
+       mount -o move /proc $1/proc && \
+       pivot_root $1 $1$2 && {
+               mount -o move $2/dev /dev
+               mount -o move $2/tmp /tmp
+               mount -o move $2/sys /sys
+               return 0
+       }
+}
+
+#just a little bit of time for the usb to settle down and get plugged in
+#technically it probably should be done in hotplug, but, we need to handle
+#the case of no key at all, and fall thru to ramdisk when it's selected
+sleep 5
+
+if [[ "$NOPIVOT" = "1" ]]; then
+  echo starting from a ramdisk
+else 
+  mount /dev/discs/disc0/disc /mnt
+  mkdir -p /mnt/old
+  pivot /mnt /old
+fi
+
diff --git a/utils/lilo/bdlilo.conf b/utils/lilo/bdlilo.conf
new file mode 100755 (executable)
index 0000000..2d773ca
--- /dev/null
@@ -0,0 +1,27 @@
+serial=0,115200n8
+boot    =/dev/loop1
+disk    =/dev/loop1
+  bios  =0x80
+  sectors =63
+  heads   =255
+  cylinders =999
+lba32
+compact
+install =mount/boot/boot.b
+map     =mount/boot/map
+
+prompt
+delay   =1
+timeout =100
+message =mount/etc/boot.msg
+append  =" root=/dev/ram0 console=ttyS0,115200n81 "
+
+
+image   =mount/vmlinuz
+  label   =openwrt
+  initrd  =mount/initrd.gz
+  
+image   =mount/vmlinuz
+  label   =ramdisk
+  initrd  =mount/initrd.gz
+  append  =" NOPIVOT=1 root=/dev/ram0 console=ttyS0,115200n81"
diff --git a/utils/lilo/boot.msg b/utils/lilo/boot.msg
new file mode 100755 (executable)
index 0000000..d587e59
--- /dev/null
@@ -0,0 +1,6 @@
+
+Boot Options:-
+
+openwrt - OpenWrt with usb stick root
+ramdisk - OpenWrt with ram root
+
diff --git a/utils/lilo/lilo.conf b/utils/lilo/lilo.conf
new file mode 100755 (executable)
index 0000000..84e8b7d
--- /dev/null
@@ -0,0 +1,24 @@
+serial=0,115200n8
+disk=/dev/discs/disc0/disc
+bios=0x80
+lba32
+compact
+install =/boot/boot.b
+map     =/boot/map
+backup  =/dev/null
+prompt
+delay   =1
+timeout =100
+message =/etc/boot.msg
+append  =" root=/dev/ram0 console=ttyS0,115200n81 "
+
+image   =/vmlinuz
+  label   =openwrt
+  initrd  =/initrd.gz
+  
+image   =/vmlinuz
+  label   =ramdisk
+  initrd  =/initrd.gz
+  append  =" NOPIVOT=1 root=/dev/ram0 console=ttyS0,115200n81"
+
+    
diff --git a/utils/lilo/mkbootable b/utils/lilo/mkbootable
new file mode 100755 (executable)
index 0000000..c95242a
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Copyright (C) 2006 OpenWrt.org
+LOOPDEV="/dev/loop1"
+
+mkdir mount
+cp bin/openwrt-x86-2.4-ext2.img bin/boot.img
+gzip -9 < bin/openwrt-x86-2.4-ext2.img > initrd.gz
+sudo losetup $LOOPDEV bin/boot.img
+sudo mount $LOOPDEV mount
+sudo cp build_i386/linux/arch/i386/boot/bzImage mount/vmlinuz
+sudo cp initrd.gz mount/initrd.gz
+sudo mkdir mount/boot
+sudo build_i386/lilo-22.7.2/lilo -C package/lilo/bdlilo.conf
+sudo umount mount
+echo releasing $LOOPDEV
+sudo losetup -d $LOOPDEV
+rm -r -f mount