Fix udev netif_rename problem
[people/pmueller/ipfire-2.x.git] / lfs / udev
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 VER = 096
28
29 THISAPP = udev-$(VER)
30 DL_FILE = $(THISAPP).tar.bz2
31 DL_FROM = $(URL_IPFIRE)
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33 ifeq "$(LFS_PASS)" "install"
34 TARGET = $(DIR_INFO)/$(THISAPP)-install
35 else
36 ifeq "$(KLIBC)" "1"
37 TARGET = $(DIR_INFO)/$(THISAPP)-klibc
38 else
39 TARGET = $(DIR_INFO)/$(THISAPP)
40 endif
41 endif
42
43 ###############################################################################
44 # Top-level Rules
45 ###############################################################################
46
47 objects = $(DL_FILE) udev-config-6.2.tar.bz2
48
49 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
50 udev-config-6.2.tar.bz2 = $(DL_FROM)/udev-config-6.2.tar.bz2
51
52 $(DL_FILE)_MD5 = f4effef7807ce1dc91ab581686ef197b
53 udev-config-6.2.tar.bz2_MD5 = 9ff2667ab0f7bfe8182966ef690078a0
54
55 install : $(TARGET)
56
57 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
58
59 download :$(patsubst %,$(DIR_DL)/%,$(objects))
60
61 md5 : $(subst %,%_MD5,$(objects))
62
63 ###############################################################################
64 # Downloading, checking, md5sum
65 ###############################################################################
66
67 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
68 @$(CHECK)
69
70 $(patsubst %,$(DIR_DL)/%,$(objects)) :
71 @$(LOAD)
72
73 $(subst %,%_MD5,$(objects)) :
74 @$(MD5)
75
76 ###############################################################################
77 # Installation Details
78 ###############################################################################
79
80 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
81 @$(PREBUILD)
82 @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
83 cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/udev-096-netif_rename.patch
84 ifeq "$(LFS_PASS)" "install"
85 cd $(DIR_APP) && make DESTDIR=/install/initrd sbindir=/sbin udevdir=/dev
86 cd $(DIR_APP) && make DESTDIR=/install/initrd sbindir=/sbin udevdir=/dev install
87 rm -f /install/initrd/sbin/udev* /install/initrd/usr/sbin/udev* /install/initrd/usr/bin/udev*
88 cd $(DIR_APP) && install udevstart udevinfo udevd udevsettle udevtrigger /install/initrd/sbin
89 cd $(DIR_APP) && make $(MAKETUNING) EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id \
90 extras/firmware extras/floppy extras/path_id \
91 extras/scsi_id extras/usb_id extras/volume_id"
92 cd $(DIR_APP) && make DESTDIR=/install/initrd EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id \
93 extras/firmware extras/floppy extras/path_id \
94 extras/scsi_id extras/usb_id extras/volume_id" install
95 cd /install/initrd/usr/share && rm -rf man
96 cd /install/initrd/dev && rm -f console
97 cd /install/initrd/dev && mknod -m 0600 console c 5 1
98 cd /install/initrd/dev && rm -f null
99 cd /install/initrd/dev && mknod -m 0777 null c 1 3
100 cd /install/initrd/dev && rm -f tty*
101 cd /install/initrd/dev && mknod -m 0600 tty1 c 4 1
102 cd /install/initrd/dev && mknod -m 0600 tty2 c 4 2
103 cd /install/initrd/dev && mknod -m 0600 tty3 c 4 3
104 cd /install/initrd/dev && mknod -m 0600 tty4 c 4 4
105 cd /install/initrd/dev && mknod -m 0600 tty5 c 4 5
106 cd /install/initrd/dev && mknod -m 0600 tty6 c 4 6
107 cp -f /etc/udev/rules.d/55-scsi-cdrom.rules /install/initrd/etc/udev/rules.d/55-scsi-cdrom.rules
108
109 else
110 ifeq "$(KLIBC)" "1"
111 cd $(DIR_APP) && sed -i "s|USE_LOG = .*|USE_LOG = false|g" Makefile
112 cd $(DIR_APP) && sed -i "s|USE_KLIBC = .*|USE_KLIBC = true|g" Makefile
113
114 cd $(DIR_APP) && make PROGRAMS="udevd udevsettle udevtrigger" EXTRAS="extras/firmware extras/cdrom_id"
115
116 -mkdir -p /lib/initcpio/udev
117 -mkdir -p /lib/initcpio/install
118 -mkdir -p /lib/initcpio/hooks
119 cd $(DIR_APP) && install -m755 udevd /lib/initcpio/udev
120 cd $(DIR_APP) && install -m755 udevtrigger /lib/initcpio/udev
121 cd $(DIR_APP) && install -m755 udevsettle /lib/initcpio/udev
122 cd $(DIR_APP) && install -m755 extras/firmware/firmware.sh /lib/initcpio/udev
123 cd $(DIR_APP) && install -m755 extras/cdrom_id/cdrom_id /lib/initcpio/udev
124
125 install -m755 $(DIR_SRC)/config/mkinitcpio/start_udev /lib/initcpio/udev
126 install -m644 $(DIR_SRC)/config/mkinitcpio/udev.rules /lib/initcpio/udev
127 install -m755 $(DIR_SRC)/config/mkinitcpio/load-modules.sh /lib/initcpio/udev
128 install -m644 $(DIR_SRC)/config/mkinitcpio/udev_install /lib/initcpio/install/udev
129 install -m644 $(DIR_SRC)/config/mkinitcpio/udev_hook /lib/initcpio/hooks/udev
130
131 else
132 rm -rf /lib/udev/devices
133 cd $(DIR_APP) && tar jxf $(DIR_DL)/udev-config-6.2.tar.bz2
134 install -dv /lib/{firmware,udev/devices/{pts,shm}}
135 echo "Put device firmwares here ..." > /lib/firmware/dirinfo
136 mknod -m0666 /lib/udev/devices/null c 1 3
137 ln -sv /proc/self/fd /lib/udev/devices/fd
138 ln -sv /proc/self/fd/0 /lib/udev/devices/stdin
139 ln -sv /proc/self/fd/1 /lib/udev/devices/stdout
140 ln -sv /proc/self/fd/2 /lib/udev/devices/stderr
141 ln -sv /proc/kcore /lib/udev/devices/core
142 cd $(DIR_APP) && make $(MAKETUNING) EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id \
143 extras/firmware extras/floppy extras/path_id \
144 extras/scsi_id extras/usb_id extras/volume_id"
145 cd $(DIR_APP) && make DESTDIR=/ EXTRAS="extras/ata_id extras/cdrom_id extras/edd_id \
146 extras/firmware extras/floppy extras/path_id \
147 extras/scsi_id extras/usb_id extras/volume_id" install
148 cd $(DIR_APP) && cp -v udev-config-6.2/[0-9]* /etc/udev/rules.d/
149 cp -rf $(DIR_SRC)/config/udev/10-dvb.rules /etc/udev/rules.d/
150 cp -rf $(DIR_SRC)/config/udev/55-scsi-cdrom.rules /etc/udev/rules.d/
151 chmod 644 /etc/udev/rules.d/10-dvb.rules
152 chmod 644 /etc/udev/rules.d/55-scsi-cdrom.rules
153 cp -rf $(DIR_SRC)/config/udev/dvb.sh /etc/udev/
154 chmod 755 /etc/udev/dvb.sh
155 touch /etc/udev/rules.d/30-persistent-network.rules
156 cp -vf $(DIR_SRC)/config/udev/blacklist /etc/modprobe.d/blacklist
157 endif
158 endif
159 @rm -rf $(DIR_APP)
160 @$(POSTBUILD)