Add lilo package for use in making bootable images for x86

git-svn-id: svn://svn.openwrt.org/openwrt/packages@4582 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
groz 2006-08-17 07:37:54 +00:00
parent d67e90152f
commit 1a0c0e1922
6 changed files with 151 additions and 0 deletions

50
utils/lilo/Makefile Executable file
View File

@ -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))

27
utils/lilo/S11Pivot Executable file
View File

@ -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

27
utils/lilo/bdlilo.conf Executable file
View File

@ -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"

6
utils/lilo/boot.msg Executable file
View File

@ -0,0 +1,6 @@
Boot Options:-
openwrt - OpenWrt with usb stick root
ramdisk - OpenWrt with ram root

24
utils/lilo/lilo.conf Executable file
View File

@ -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"

17
utils/lilo/mkbootable Executable file
View File

@ -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