X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=blobdiff_plain;f=lfs%2Finitrd;h=c5ceb3200e085cb4755d0f6098eb444dfa358223;hp=66c578e7ff9772bd37961507f43fd5288d148647;hb=76d8ffc43bc2d9ebae9311185a9c6613db7860f3;hpb=cd1a2927226c734d96478e12bb768256fb64a06a diff --git a/lfs/initrd b/lfs/initrd index 66c578e7ff..c5ceb3200e 100644 --- a/lfs/initrd +++ b/lfs/initrd @@ -1,28 +1,20 @@ ############################################################################### -# This file is part of the IPCop Firewall. # # # -# IPCop is free software; you can redistribute it and/or modify # +# IPFire.org - A linux based firewall # +# Copyright (C) 2010 IPFire Team # +# # +# This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # -# the Free Software Foundation; either version 2 of the License, or # +# the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # -# IPCop is distributed in the hope that it will be useful, # +# This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # -# along with IPCop; if not, write to the Free Software # -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# # -# Makefiles are based on LFSMake, which is # -# Copyright (C) 2002 Rod Roard # -# # -# Modifications by: # -# ??-12-2003 Mark Wormgoor < mark@wormgoor.com> # -# - Modified Makefile for IPCop build # -# # -# $Id: initrd,v 1.26.2.8 2005/12/03 21:28:44 franck78 Exp $ +# along with this program. If not, see . # # # ############################################################################### @@ -32,6 +24,8 @@ include Config +VER = ipfire + THISAPP = initrd DIR_APP = $(DIR_SRC)/$(THISAPP) TARGET = $(DIR_INFO)/$(THISAPP) @@ -54,95 +48,43 @@ md5 : $(TARGET) : @$(PREBUILD) - rm -f /install/images/{cdinitrd,cdinitrd.gz,fdinitrd,fdinitrd.gz} - -strip --strip-all /install/misc/bin/* - -strip --strip-all /install/initrd/bin/* - -strip --strip-debug /install/initrd/lib/* + rm -f /install/images/initrd # Finish up initrd directory - -mkdir -p /install/initrd/{etc,lib/modules/$(KVER)/kernel/drivers,cdrom,dev,harddisk,proc,tmp,usr/share/terminfo/l,var/run} && \ - ln -sf /bin /install/initrd/sbin - cd /install/initrd/dev && /dev/make_devices + -mkdir -p /install/initrd/{dev,etc,mnt,root,lib/modules/$(KVER)-ipfire/kernel/drivers,cdrom,dev,harddisk,proc,tmp,usr/share/terminfo/l,var/run,sys} + cd /install/initrd && lzma -d -c /boot/ipfirerd-$(KVER).img | cpio -i + + # Copy Files packages for installer + find $(DIR_SRC)/config/rootfiles/installer/* -maxdepth 1 | xargs cat | grep -v "^#" > /tmp/ROOTFILES + + # Patch Kernel Version to rootfiles + sed -e "s/KVER/$(KVER)/g" -i /tmp/ROOTFILES + + -cd / && cpio -d -p /install/initrd < /tmp/ROOTFILES + + cd /install/initrd/etc && rm -f fstab cp -aRf $(DIR_SRC)/config/install/* /install/initrd/etc/ - rm -rf /install/initrd/etc/CVS/ - cd /install/initrd/dev && ln -sf fd0 floppy - chmod 755 /install/initrd/etc/halt /install/initrd/etc/rc - cp -f /usr/share/terminfo/l/linux /install/initrd/usr/share/terminfo/l - - if [ "$(MACHINE)" = "alpha" ]; then \ - tar cvzf /tmp/libc.tgz /usr/share/locale /lib/libc.* /lib/libc-* /lib/libdl* /lib/libnsl* /lib/libresolv* /lib/libutil* /lib/ld* /lib/libcrypt*; \ - tar xvzf /tmp/libc.tgz -C /install/initrd; \ - strip /install/initrd/lib/*; \ - rm -f /tmp/libc.tgz; \ - fi - - # Extra modules - -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/scsi - cp -f /lib/modules/$(KVER)/kernel/drivers/scsi/{scsi_mod.o.gz,sd_mod.o.gz,sr_mod.o.gz} \ - /install/initrd/lib/modules/$(KVER)/kernel/drivers/scsi/ - -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/storage/ - cp -f /lib/modules/$(KVER)/kernel/drivers/usb/storage/*.o.gz \ - /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/storage/ - - -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/host/ - cp -f /lib/modules/$(KVER)/kernel/drivers/usb/host/{usb-*,ehci*} \ - /lib/modules/$(KVER)/kernel/drivers/usb/hid.o.gz \ - /lib/modules/$(KVER)/kernel/drivers/usb/*core.o.gz \ - /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/ - - -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/input - cp -f /lib/modules/$(KVER)/kernel/drivers/input/{input.o.gz,keybdev.o.gz} \ - /install/initrd/lib/modules/$(KVER)/kernel/drivers/input/ - - -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/pnp - cp -f /lib/modules/$(KVER)/kernel/drivers/pnp/* \ - /install/initrd/lib/modules/$(KVER)/kernel/drivers/pnp/ - - cp -f /lib/modules/$(KVER)/modules.* /install/initrd/lib/modules/$(KVER)/ - - # Floppy initrd + rm -rf /install/initrd/usr/share/man + chmod 755 /install/initrd/etc/halt /install/initrd/etc/rc_installer + + cd /install/initrd/ && patch -Np0 < $(DIR_SRC)/src/patches/dracut-init_start_ipfireinstaller.patch + + # make new dependencies + depmod -a -F /boot/System.map-$(KVER)-ipfire $(KVER)-ipfire + -mkdir -p /install/{images,mnt} - RAMDISK_SIZE=`grep CONFIG_BLK_DEV_RAM_SIZE $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) | sed -e 's/CONFIG_BLK_DEV_RAM_SIZE=//'` && \ - dd if=/dev/zero of=/install/images/fdinitrd bs=1k count=$${RAMDISK_SIZE} - for i in `seq 0 7`; do \ - if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \ - LOOPDEV="/dev/loop$${i}" \ - break; \ - fi; \ - done && \ - losetup $$LOOPDEV /install/images/fdinitrd && \ - mke2fs -m 0 -N 1024 $$LOOPDEV && \ - mount -t ext2 $$LOOPDEV /install/mnt && \ - rm -rf /install/mnt/lost+found && \ - cp -aR /install/initrd/* /install/mnt/ && \ - umount /install/mnt && \ - losetup -d $$LOOPDEV - gzip -9 /install/images/fdinitrd - - # CDRom initrd, add vfat modules - -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/fs - cp -fR /lib/modules/$(KVER)/kernel/fs/* \ - /install/initrd/lib/modules/$(KVER)/kernel/fs/ - - RAMDISK_SIZE=`grep CONFIG_BLK_DEV_RAM_SIZE $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) | sed -e 's/CONFIG_BLK_DEV_RAM_SIZE=//'` && \ - dd if=/dev/zero of=/install/images/cdinitrd bs=1k count=$${RAMDISK_SIZE} - for i in `seq 0 7`; do \ - if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \ - LOOPDEV="/dev/loop$${i}" \ - break; \ - fi; \ - done && \ - losetup $$LOOPDEV /install/images/cdinitrd && \ - mke2fs -m 0 -N 1024 $$LOOPDEV && \ - mount -t ext2 $$LOOPDEV /install/mnt && \ - rm -rf /install/mnt/lost+found && \ - cp -aR /install/initrd/* /install/mnt/ && \ - cd /install/mnt && tar xfz /install/images/drivers-$(VERSION).img && \ - cd /install/mnt && tar xfz /install/images/scsidrv-$(VERSION).img && \ - cp -a /install/misc/bin/* /install/mnt/bin && \ - touch /install/mnt/CDROMBOOT && \ - cd / && umount /install/mnt && \ - losetup -d $$LOOPDEV - gzip -9 /install/images/cdinitrd + rm -rf /install/mnt/* + + #Build Module deps for installer. + depmod -a -b /install/initrd/ -F /boot/System.map-$(KVER)-ipfire $(KVER)-ipfire + # Remove binary depmod files + rm -rf /install/initrd/lib/modules/$(KVER)-ipfire/modules.*.bin + + #Name service from dhcpcd + cp -f /etc/nsswitch.conf /install/initrd/etc/ + cp -f $(DIR_SRC)/config/initrd/dhcpc/* /install/initrd/var/ipfire/dhcpc/dhcpcd-hooks/ + + cd /install/initrd && find . | cpio -o -H newc | lzma > /install/images/initrd + cd /install/initrd && find ./ -ls > $(DIR_INFO)/_build.initrd.log @$(POSTBUILD)