]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - lfs/initrd
Zwischencommit Rootfiles...
[people/pmueller/ipfire-2.x.git] / lfs / initrd
1 ###############################################################################
2 # This file is part of the IPCop Firewall. #
3 # #
4 # IPCop is free software; you can redistribute it and/or modify #
5 # it under the terms of the GNU General Public License as published by #
6 # the Free Software Foundation; either version 2 of the License, or #
7 # (at your option) any later version. #
8 # #
9 # IPCop is distributed in the hope that it will be useful, #
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12 # GNU General Public License for more details. #
13 # #
14 # You should have received a copy of the GNU General Public License #
15 # along with IPCop; if not, write to the Free Software #
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
17 # #
18 # Makefiles are based on LFSMake, which is #
19 # Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com> #
20 # #
21 ###############################################################################
22
23 ###############################################################################
24 # Definitions
25 ###############################################################################
26
27 include Config
28
29 VER = ipfire
30
31 THISAPP = initrd
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33 TARGET = $(DIR_INFO)/$(THISAPP)
34
35 ###############################################################################
36 # Top-level Rules
37 ###############################################################################
38
39 install : $(TARGET)
40
41 check :
42
43 download :
44
45 md5 :
46
47 ###############################################################################
48 # Installation Details
49 ###############################################################################
50
51 $(TARGET) :
52 @$(PREBUILD)
53 rm -f /install/images/{cdinitrd,cdinitrd.gz,fdinitrd,fdinitrd.gz}
54 -strip --strip-all /install/misc/bin/*
55 -strip --strip-all /install/initrd/bin/*
56 -strip --strip-debug /install/initrd/lib/*
57
58 # Finish up initrd directory
59 -mkdir -p /install/initrd/{etc,lib/modules/$(KVER)/kernel/drivers,cdrom,dev,harddisk,proc,tmp,usr/share/terminfo/l,var/run} && \
60 ln -sf /bin /install/initrd/sbin
61 # cd /install/initrd/dev && /dev/make_devices
62 cp -aRf $(DIR_SRC)/config/install/* /install/initrd/etc/
63 rm -rf /install/initrd/etc/CVS/
64 cd /install/initrd/dev && ln -sf fd0 floppy
65 chmod 755 /install/initrd/etc/halt /install/initrd/etc/rc
66 cp -f /usr/share/terminfo/l/linux /install/initrd/usr/share/terminfo/l
67
68 # Extra modules
69 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/scsi
70 cp -f /lib/modules/$(KVER)/kernel/drivers/scsi/{scsi_mod.ko,sd_mod.ko,sr_mod.ko} \
71 /install/initrd/lib/modules/$(KVER)/kernel/drivers/scsi/
72 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/storage/
73 cp -f /lib/modules/$(KVER)/kernel/drivers/usb/storage/*.ko \
74 /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/storage/
75
76 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/host/
77 cp -f /lib/modules/$(KVER)/kernel/drivers/usb/host/ehci* \
78 /lib/modules/$(KVER)/kernel/drivers/usb/input/usbhid.ko \
79 /lib/modules/$(KVER)/kernel/drivers/usb/core/usbcore.ko \
80 /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/
81
82 # -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/input
83 # cp -f /lib/modules/$(KVER)/kernel/drivers/input/{input.ko,keybdev.ko} \
84 # /install/initrd/lib/modules/$(KVER)/kernel/drivers/input/
85
86 # -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/pnp
87 # cp -f /lib/modules/$(KVER)/kernel/drivers/pnp/* \
88 # /install/initrd/lib/modules/$(KVER)/kernel/drivers/pnp/
89
90 cp -f /lib/modules/$(KVER)/modules.* /install/initrd/lib/modules/$(KVER)/
91
92 # Floppy initrd
93 -mkdir -p /install/{images,mnt}
94 RAMDISK_SIZE=`grep CONFIG_BLK_DEV_RAM_SIZE $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) | sed -e 's/CONFIG_BLK_DEV_RAM_SIZE=//'` && \
95 dd if=/dev/zero of=/install/images/fdinitrd bs=1k count=$${RAMDISK_SIZE}
96 for i in `seq 0 7`; do \
97 if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \
98 LOOPDEV="/dev/loop$${i}" \
99 break; \
100 fi; \
101 done && \
102 losetup $$LOOPDEV /install/images/fdinitrd && \
103 mke2fs -m 0 -N 1024 $$LOOPDEV && \
104 mount -t ext2 $$LOOPDEV /install/mnt && \
105 rm -rf /install/mnt/lost+found && \
106 cp -aR /install/initrd/* /install/mnt/ && \
107 umount /install/mnt && \
108 losetup -d $$LOOPDEV
109 gzip -9 /install/images/fdinitrd
110
111 # CDRom initrd, add vfat modules
112 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/fs
113 cp -fR /lib/modules/$(KVER)/kernel/fs/* \
114 /install/initrd/lib/modules/$(KVER)/kernel/fs/
115
116 RAMDISK_SIZE=`grep CONFIG_BLK_DEV_RAM_SIZE $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) | sed -e 's/CONFIG_BLK_DEV_RAM_SIZE=//'` && \
117 dd if=/dev/zero of=/install/images/cdinitrd bs=1k count=$${RAMDISK_SIZE}
118 for i in `seq 0 7`; do \
119 if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \
120 LOOPDEV="/dev/loop$${i}" \
121 break; \
122 fi; \
123 done && \
124 losetup $$LOOPDEV /install/images/cdinitrd && \
125 mke2fs -m 0 -N 1024 $$LOOPDEV && \
126 mount -t ext2 $$LOOPDEV /install/mnt && \
127 rm -rf /install/mnt/lost+found && \
128 cp -aR /install/initrd/* /install/mnt/ && \
129 cd /install/mnt && tar xfz /install/images/drivers-$(VERSION).img # && \
130 # cd /install/mnt && tar xfz /install/images/scsidrv-$(VERSION).img && \
131 cp -a /install/misc/bin/* /install/mnt/bin && \
132 touch /install/mnt/CDROMBOOT && \
133 cd / && umount /install/mnt && \
134 losetup -d $$LOOPDEV
135 gzip -9 /install/images/cdinitrd
136
137 @$(POSTBUILD)