Remove obsolete files (INSTALL, RELNOTES)
[gpxe.git] / contrib / initrd / Makefile
blobf18b73f6edd4a59c19570cae9b86bbd432b1d14f
1 UCLIBC_VERSION = 0.9.11
2 UCLIBC = uClibc-$(UCLIBC_VERSION)
3 $(UCLIBC)_SOURCE = http://www.uclibc.org/downloads/$(UCLIBC).tar.bz2
4 UCLIBC_INSTALL = $(CURDIR)/uClibc
6 UDHCP_VERSION = 0.9.7
7 UDHCP = udhcp-$(UDHCP_VERSION)
8 $(UDHCP)_SOURCE = http://udhcp.busybox.net/source/$(UDHCP).tar.gz
10 BUSYBOX_VERSION = 0.60.3
11 BUSYBOX = busybox-$(BUSYBOX_VERSION)
12 $(BUSYBOX)_SOURCE = http://www.busybox.net/downloads/$(BUSYBOX).tar.bz2
14 LINUX_WLAN_VERSION = 0.1.13
15 LINUX_WLAN = linux-wlan-ng-$(LINUX_WLAN_VERSION)
16 $(LINUX_WLAN)_SOURCE = ftp://ftp.linux-wlan.org/pub/linux-wlan-ng/$(LINUX_WLAN).tar.gz
18 MKNBI_VERSION = 1.2
19 MKNBI = mknbi-$(MKNBI_VERSION)
20 $(MKNBI)_SOURCE = http://belnet.dl.sourceforge.net/sourceforge/etherboot/$(MKNBI).tar.gz
22 export PATH := $(UCLIBC_INSTALL)/bin:$(PATH)
24 all : utils initrd-skel mknbi mknbi-linux
25 # Run "make tftpboot/initrd-kernel_module.img" to generate a suitable initrd
26 # Run "make tftpboot/boot-kernel_module.nbi" to generate a suitable NBI
27 # Run "make all-nbi" to generate a complete set of NBIs
29 %.tar.bz2 :
30 [ -d $* ] || wget $($*_SOURCE)
31 [ -f $*.t*gz ] && ( gunzip $*.t*gz ; bzip2 -9 $*.tar ) || true
33 UTILS = udhcpc busybox wlanctl
35 utils : $(UTILS)
37 clean : partlyclean
38 rm -rf uClibc
39 rm -rf $(UCLIBC)
40 rm -rf tftpboot/*
42 partlyclean :
43 rm -rf $(UDHCP)
44 rm -rf $(BUSYBOX)
45 rm -rf $(LINUX_WLAN)
46 rm -rf $(MKNBI)
47 rm -rf initrd-skel
48 rm -f *.img *.ird *.nbi insert-modules
49 rm -f $(UTILS) mknbi-linux
50 rm -f *.uClibc *.busybox *.udhcpc *.wlanctl
52 .PHONY : all utils clean partlyclean
54 uClibc : $(UCLIBC)
55 rm -rf $@
56 $(MAKE) -C $(UCLIBC) install
58 $(UCLIBC) : $(UCLIBC).tar.bz2
59 [ -d $@ ] || tar xvjf $<
60 [ -f $(UCLIBC)/Config ] || perl -pe 's/^(INCLUDE_RPC).*/$$1 = true/ ;' \
61 -e 's{^(DEVEL_PREFIX).*}{$$1 = $(UCLIBC_INSTALL)} ;' \
62 -e 's{^(SHARED_LIB_LOADER_PATH).*}{$$1 = /lib} ;' \
63 $(UCLIBC)/extra/Configs/Config.i386 > $(UCLIBC)/Config
64 # Stripping out spurious CVS directories (screws up local cvs update)
65 rm -rf `find $(UCLIBC) -name CVS`
66 $(MAKE) -C $(UCLIBC)
67 install -m 644 $(UCLIBC)/COPYING.LIB COPYING.uClibc
69 udhcpc : $(UDHCP)
70 install -m 755 -s $(UDHCP)/$@ $@
72 $(UDHCP) : $(UDHCP).tar.bz2 uClibc
73 [ -d $@ ] || tar xvjf $<
74 if [ ! -f $@/.script.c.patch ]; then \
75 patch -d $@ -b -z .orig < script.c.patch ; \
76 touch $@/.script.c.patch ; \
78 $(MAKE) LDFLAGS+=-static -C $(UDHCP)
79 install -m 644 $(UDHCP)/AUTHORS AUTHORS.udhcpc
80 install -m 644 $(UDHCP)/COPYING COPYING.udhcpc
82 busybox : $(BUSYBOX)
83 install -m 755 -s $(BUSYBOX)/$@ $@
85 $(BUSYBOX) : $(BUSYBOX).tar.bz2 uClibc
86 [ -d $@ ] || tar xvjf $<
87 perl -pi.orig -e \
88 's/^.*(#define BB_(FEATURE_NFSMOUNT|INSMOD|PIVOT_ROOT|IFCONFIG|ROUTE)).*/$$1/' \
89 $(BUSYBOX)/Config.h
90 perl -pi.orig -e \
91 's/^(DOSTATIC).*$$/$$1 = true/' \
92 $(BUSYBOX)/Makefile
93 $(MAKE) -C $(BUSYBOX)
94 install -m 644 $(BUSYBOX)/AUTHORS AUTHORS.busybox
95 install -m 644 $(BUSYBOX)/LICENSE LICENSE.busybox
97 wlanctl : $(LINUX_WLAN)
98 install -m 755 -s $(LINUX_WLAN)/src/wlanctl/$@ $@
100 $(LINUX_WLAN) : $(LINUX_WLAN).tar.bz2 uClibc linux-wlan.cfg
101 [ -d $@ ] || tar xvjf $<
102 cd $(LINUX_WLAN) ; ./Configure -d ../linux-wlan.cfg
103 perl -pi.orig -e \
104 's/(-o wlanctl)/-static $$1/' \
105 $(LINUX_WLAN)/src/wlanctl/Makefile
106 $(MAKE) -C $(LINUX_WLAN)/src/wlanctl
107 install -m 644 $(LINUX_WLAN)/COPYING COPYING.wlanctl
108 install -m 644 $(LINUX_WLAN)/LICENSE LICENSE.wlanctl
109 install -m 644 $(LINUX_WLAN)/THANKS THANKS.wlanctl
111 mknbi-linux : $(MKNBI)
113 mknbi : $(MKNBI)
115 $(MKNBI) : $(MKNBI).tar.bz2
116 [ -d $@ ] || tar xvjf $<
117 if [ ! -f $@/.mknbi-encap.patch ]; then \
118 patch -d $@ -b -z .orig < mknbi-encap.patch ; \
119 touch $@/.mknbi-encap.patch ; \
121 make -C $(MKNBI) LIBDIR=`pwd`/$(MKNBI) mknbi
122 install -m 755 $(MKNBI)/mknbi mknbi-linux
123 make -C $(MKNBI) clean
124 make -C $(MKNBI)
126 initrd-skel : $(UTILS) linuxrc udhcpc-post include-modules
127 rm -rf $@
128 mkdir -p $@
129 mkdir -p $@/dev
130 mkdir -p $@/etc
131 mkdir -p $@/bin
132 mkdir -p $@/lib
133 mkdir -p $@/lib/modules
134 mkdir -p $@/proc
135 mkdir -p $@/sysroot
136 ln -s bin $@/sbin
137 install -m 755 busybox $@/bin/
138 install -m 755 udhcpc $@/bin/
139 install -m 755 wlanctl $@/bin/
140 ln -s busybox $@/bin/sh
141 ln -s busybox $@/bin/echo
142 ln -s busybox $@/bin/mknod
143 ln -s busybox $@/bin/chmod
144 ln -s busybox $@/bin/insmod
145 ln -s busybox $@/bin/ifconfig
146 ln -s busybox $@/bin/route
147 ln -s busybox $@/bin/mount
148 ln -s busybox $@/bin/pivot_root
149 ln -s busybox $@/bin/umount
150 ln -s busybox $@/bin/[
151 ln -s busybox $@/bin/sleep
152 ln -s busybox $@/bin/grep
154 install -m 755 linuxrc $@/linuxrc
155 install -m 755 udhcpc-post $@/bin/udhcpc-post
157 tftpboot/initrd-%.img : initrd-skel
158 ./mkinitrd-net -l `echo $* | tr . " "`
160 tftpboot/boot-%.nbi : tftpboot/initrd-%.img mknbi-linux
161 ./mknbi-linux --format=nbi --target=linux /boot/vmlinuz $< > $@
162 sudo cp $@ $(tftpbootdir)
164 all-nbi : all
165 ./mknbi-set -l -v
166 ls tftpboot
168 prefix = /usr
169 sysconfdir = /etc
170 bindir = $(prefix)/bin
171 libdir = $(prefix)/lib
172 mandir = $(prefix)/share/man
173 docdir = $(prefix)/share/doc
174 tftpbootdir = /var/lib/tftpboot
175 initrdskeldir = $(prefix)/lib/mkinitrd-net/initrd-skel
177 install :
178 mkdir -p $(libdir)/mknbi
179 mkdir -p $(bindir)
180 mkdir -p $(sysconfdir)
181 mkdir -p $(tftpbootdir)
182 mkdir -p $(initrdskeldir)
183 install -m 755 mkinitrd-net include-modules mknbi-set $(bindir)/
184 cp -a initrd-skel/* $(initrdskeldir)/
185 install -m 644 mknbi-set.conf dhcpd.conf.etherboot.include $(sysconfdir)
186 make -C $(MKNBI) INSTPREFIX=$(prefix) MANDIR=$(mandir)/man1 \
187 DOCDIR=$(docdir)/$(MKNBI) install