From 81bd7011aace4df4cfdab1dad4f168f5d39b5a08 Mon Sep 17 00:00:00 2001 From: Gerry Rozema Date: Thu, 17 Aug 2006 07:37:54 +0000 Subject: [PATCH] Add lilo package for use in making bootable images for x86 SVN-Revision: 4582 --- utils/lilo/Makefile | 50 ++++++++++++++++++++++++++++++++++++++++++ utils/lilo/S11Pivot | 27 +++++++++++++++++++++++ utils/lilo/bdlilo.conf | 27 +++++++++++++++++++++++ utils/lilo/boot.msg | 6 +++++ utils/lilo/lilo.conf | 24 ++++++++++++++++++++ utils/lilo/mkbootable | 17 ++++++++++++++ 6 files changed, 151 insertions(+) create mode 100755 utils/lilo/Makefile create mode 100755 utils/lilo/S11Pivot create mode 100755 utils/lilo/bdlilo.conf create mode 100755 utils/lilo/boot.msg create mode 100755 utils/lilo/lilo.conf create mode 100755 utils/lilo/mkbootable diff --git a/utils/lilo/Makefile b/utils/lilo/Makefile new file mode 100755 index 000000000..88f16ab50 --- /dev/null +++ b/utils/lilo/Makefile @@ -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 index 000000000..6962b6d9c --- /dev/null +++ b/utils/lilo/S11Pivot @@ -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() { # + 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 index 000000000..2d773caad --- /dev/null +++ b/utils/lilo/bdlilo.conf @@ -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 index 000000000..d587e5923 --- /dev/null +++ b/utils/lilo/boot.msg @@ -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 index 000000000..84e8b7d20 --- /dev/null +++ b/utils/lilo/lilo.conf @@ -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 index 000000000..c95242ad0 --- /dev/null +++ b/utils/lilo/mkbootable @@ -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 -- 2.30.2