]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/initrd
Kudzu, ReiserFS, uClibc, gettext und Arbeit am Installer
[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
55 # Finish up initrd directory
56 -mkdir -p /install/initrd/{dev,etc,mnt,root,lib/modules/$(KVER)/kernel/drivers,cdrom,dev,harddisk,proc,tmp,usr/share/terminfo/l,var/run,sys} && \
57 cd /install/initrd && ln -sfn bin sbin
58 cd /install/initrd/etc && rm -f fstab
59 cp -aRf $(DIR_SRC)/config/install/* /install/initrd/etc/
60 rm -rf /install/initrd/etc{,/udev,/udev/rules.d}/.svn
61 rm -rf /install/initrd/usr/share/man
62 chmod 755 /install/initrd/etc/halt /install/initrd/etc/rc
63 cp -f /usr/share/terminfo/l/linux /install/initrd/usr/share/terminfo/l
64
65 # Extra modules
66 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/scsi
67 cp -f /lib/modules/$(KVER)/kernel/drivers/scsi/{scsi_mod.ko,sd_mod.ko,sr_mod.ko} \
68 /install/initrd/lib/modules/$(KVER)/kernel/drivers/scsi/
69
70 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/storage
71 cp -f /lib/modules/$(KVER)/kernel/drivers/usb/storage/*.ko \
72 /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/storage/
73
74 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/host
75 cp -f /lib/modules/$(KVER)/kernel/drivers/usb/host/*.ko \
76 /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/host
77
78 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/input
79 cp -f /lib/modules/$(KVER)/kernel/drivers/usb/input/usbhid.ko \
80 /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/input
81
82 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/core
83 cp -f /lib/modules/$(KVER)/kernel/drivers/usb/core/*.ko \
84 /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/core
85
86 # File system
87 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/fs
88 cp -rf /lib/modules/$(KVER)/kernel/fs/* /install/initrd/lib/modules/$(KVER)/kernel/fs
89
90 cp -f /lib/modules/$(KVER)/modules.* /install/initrd/lib/modules/$(KVER)
91
92 cp /opt/$(MACHINE)-uClibc/lib/libgcc_s.so.1 /install/initrd/lib/
93
94 cd /install/initrd/lib/ && ln -sf libgcc_s.so.1 libgcc_s.so
95
96 # Floppy initrd
97 -mkdir -p /install/{images,mnt}
98 rm -rf /install/mnt/*
99
100 cp -aR /install/initrd/* /install/mnt
101 # cp -a /install/misc/bin/* /install/mnt/bin
102
103 # make new dependencies
104 depmod -a -F /boot/System.map-$(KVER) $(KVER)
105 touch /install/mnt/FLOPPYBOOT
106
107 RAMDISK_SIZE=8192 && \
108 dd if=/dev/zero of=/install/images/fdinitrd bs=1k count=$${RAMDISK_SIZE}
109 for i in `seq 0 7`; do \
110 if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \
111 LOOPDEV="/dev/loop$${i}" \
112 break; \
113 fi; \
114 done && \
115 losetup $$LOOPDEV /install/images/fdinitrd && \
116 mke2fs -m 0 -N 1024 $$LOOPDEV && \
117 mount -t ext2 $$LOOPDEV /install/mnt && \
118 rm -rf /install/mnt/lost+found && \
119 cp -aR /install/initrd/* /install/mnt/ && \
120 cd /install/mnt/ && find ./ -ls > $(DIR_INFO)/_build.fdinitrd && \
121 cd / && umount /install/mnt && \
122 losetup -d $$LOOPDEV
123 gzip -9 /install/images/fdinitrd
124
125 RAMDISK_SIZE=16384 && \
126 dd if=/dev/zero of=/install/images/cdinitrd bs=1k count=$${RAMDISK_SIZE}
127 for i in `seq 0 7`; do \
128 if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \
129 LOOPDEV="/dev/loop$${i}" \
130 break; \
131 fi; \
132 done && \
133 losetup $$LOOPDEV /install/images/cdinitrd && \
134 mke2fs -m 0 -N 1024 $$LOOPDEV && \
135 mount -t ext2 $$LOOPDEV /install/mnt && \
136 rm -rf /install/mnt/lost+found && \
137 cp -aR /install/initrd/* /install/mnt/ && \
138 cd /install/mnt && tar xfz /install/images/drivers-$(VERSION).img && \
139 cd /install/mnt && tar xfz /install/images/scsidrv-$(VERSION).img && \
140 cd /install/mnt/ && find ./ -ls > $(DIR_INFO)/_build.cdinitrd && \
141 touch /install/mnt/CDROMBOOT && \
142 cd / && umount /install/mnt && \
143 losetup -d $$LOOPDEV
144 gzip -9 /install/images/cdinitrd
145
146 @$(POSTBUILD)