]> git.ipfire.org Git - ipfire-2.x.git/blame - lfs/initrd
HinzugefĆ¼gt:
[ipfire-2.x.git] / lfs / initrd
CommitLineData
cd1a2927
MT
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# Modifications by: #
22# ??-12-2003 Mark Wormgoor < mark@wormgoor.com> #
23# - Modified Makefile for IPCop build #
24# #
25# $Id: initrd,v 1.26.2.8 2005/12/03 21:28:44 franck78 Exp $
26# #
27###############################################################################
28
29###############################################################################
30# Definitions
31###############################################################################
32
33include Config
34
35THISAPP = initrd
36DIR_APP = $(DIR_SRC)/$(THISAPP)
37TARGET = $(DIR_INFO)/$(THISAPP)
38
39###############################################################################
40# Top-level Rules
41###############################################################################
42
43install : $(TARGET)
44
45check :
46
47download :
48
49md5 :
50
51###############################################################################
52# Installation Details
53###############################################################################
54
55$(TARGET) :
56 @$(PREBUILD)
57 rm -f /install/images/{cdinitrd,cdinitrd.gz,fdinitrd,fdinitrd.gz}
58 -strip --strip-all /install/misc/bin/*
59 -strip --strip-all /install/initrd/bin/*
60 -strip --strip-debug /install/initrd/lib/*
61
62 # Finish up initrd directory
63 -mkdir -p /install/initrd/{etc,lib/modules/$(KVER)/kernel/drivers,cdrom,dev,harddisk,proc,tmp,usr/share/terminfo/l,var/run} && \
64 ln -sf /bin /install/initrd/sbin
65 cd /install/initrd/dev && /dev/make_devices
66 cp -aRf $(DIR_SRC)/config/install/* /install/initrd/etc/
67 rm -rf /install/initrd/etc/CVS/
68 cd /install/initrd/dev && ln -sf fd0 floppy
69 chmod 755 /install/initrd/etc/halt /install/initrd/etc/rc
70 cp -f /usr/share/terminfo/l/linux /install/initrd/usr/share/terminfo/l
71
72 if [ "$(MACHINE)" = "alpha" ]; then \
73 tar cvzf /tmp/libc.tgz /usr/share/locale /lib/libc.* /lib/libc-* /lib/libdl* /lib/libnsl* /lib/libresolv* /lib/libutil* /lib/ld* /lib/libcrypt*; \
74 tar xvzf /tmp/libc.tgz -C /install/initrd; \
75 strip /install/initrd/lib/*; \
76 rm -f /tmp/libc.tgz; \
77 fi
78
79 # Extra modules
80 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/scsi
81 cp -f /lib/modules/$(KVER)/kernel/drivers/scsi/{scsi_mod.o.gz,sd_mod.o.gz,sr_mod.o.gz} \
82 /install/initrd/lib/modules/$(KVER)/kernel/drivers/scsi/
83 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/storage/
84 cp -f /lib/modules/$(KVER)/kernel/drivers/usb/storage/*.o.gz \
85 /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/storage/
86
87 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/host/
88 cp -f /lib/modules/$(KVER)/kernel/drivers/usb/host/{usb-*,ehci*} \
89 /lib/modules/$(KVER)/kernel/drivers/usb/hid.o.gz \
90 /lib/modules/$(KVER)/kernel/drivers/usb/*core.o.gz \
91 /install/initrd/lib/modules/$(KVER)/kernel/drivers/usb/
92
93 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/input
94 cp -f /lib/modules/$(KVER)/kernel/drivers/input/{input.o.gz,keybdev.o.gz} \
95 /install/initrd/lib/modules/$(KVER)/kernel/drivers/input/
96
97 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/drivers/pnp
98 cp -f /lib/modules/$(KVER)/kernel/drivers/pnp/* \
99 /install/initrd/lib/modules/$(KVER)/kernel/drivers/pnp/
100
101 cp -f /lib/modules/$(KVER)/modules.* /install/initrd/lib/modules/$(KVER)/
102
103 # Floppy initrd
104 -mkdir -p /install/{images,mnt}
105 RAMDISK_SIZE=`grep CONFIG_BLK_DEV_RAM_SIZE $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) | sed -e 's/CONFIG_BLK_DEV_RAM_SIZE=//'` && \
106 dd if=/dev/zero of=/install/images/fdinitrd bs=1k count=$${RAMDISK_SIZE}
107 for i in `seq 0 7`; do \
108 if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \
109 LOOPDEV="/dev/loop$${i}" \
110 break; \
111 fi; \
112 done && \
113 losetup $$LOOPDEV /install/images/fdinitrd && \
114 mke2fs -m 0 -N 1024 $$LOOPDEV && \
115 mount -t ext2 $$LOOPDEV /install/mnt && \
116 rm -rf /install/mnt/lost+found && \
117 cp -aR /install/initrd/* /install/mnt/ && \
118 umount /install/mnt && \
119 losetup -d $$LOOPDEV
120 gzip -9 /install/images/fdinitrd
121
122 # CDRom initrd, add vfat modules
123 -mkdir -p /install/initrd/lib/modules/$(KVER)/kernel/fs
124 cp -fR /lib/modules/$(KVER)/kernel/fs/* \
125 /install/initrd/lib/modules/$(KVER)/kernel/fs/
126
127 RAMDISK_SIZE=`grep CONFIG_BLK_DEV_RAM_SIZE $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) | sed -e 's/CONFIG_BLK_DEV_RAM_SIZE=//'` && \
128 dd if=/dev/zero of=/install/images/cdinitrd bs=1k count=$${RAMDISK_SIZE}
129 for i in `seq 0 7`; do \
130 if (! losetup /dev/loop$${i} >/dev/null 2>&1 ); then \
131 LOOPDEV="/dev/loop$${i}" \
132 break; \
133 fi; \
134 done && \
135 losetup $$LOOPDEV /install/images/cdinitrd && \
136 mke2fs -m 0 -N 1024 $$LOOPDEV && \
137 mount -t ext2 $$LOOPDEV /install/mnt && \
138 rm -rf /install/mnt/lost+found && \
139 cp -aR /install/initrd/* /install/mnt/ && \
140 cd /install/mnt && tar xfz /install/images/drivers-$(VERSION).img && \
141 cd /install/mnt && tar xfz /install/images/scsidrv-$(VERSION).img && \
142 cp -a /install/misc/bin/* /install/mnt/bin && \
143 touch /install/mnt/CDROMBOOT && \
144 cd / && umount /install/mnt && \
145 losetup -d $$LOOPDEV
146 gzip -9 /install/images/cdinitrd
147
148 @$(POSTBUILD)