7 include $(TOPDIR
)/..
/toolchain
/vars.mk
9 TARGET
= arm-crux-linux-gnueabi
13 CLFS
= $(TOPDIR
)/..
/toolchain
/clfs
14 CROSSTOOLS
= $(TOPDIR
)/..
/toolchain
/crosstools
17 KERNEL_PATH
= $(PWD
)/..
/kernel
/$(DEVICE
)
18 KERNEL_VERSION
= $(shell grep
'^KERNEL_VERSION = ' $(KERNEL_PATH
)/Makefile | sed
's|KERNEL_VERSION = ||')
20 BUSYBOX_VERSION
= 1.19.4
21 BUSYBOX_SOURCE
= http
://busybox.net
/downloads
/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
23 DIALOG_VERSION
= 1.1-20120215
24 DIALOG_SOURCE
= ftp
://dickey.his.com
/dialog
/dialog-
$(DIALOG_VERSION
).tgz
26 NCURSES_HEADER
= $(CLFS
)/usr
/include/ncurses.h
28 .PHONY
: all check-root busybox dialog initramfs
clean distclean
30 all: busybox dialog initramfs
32 clean: busybox-clean dialog-clean initramfs-clean
34 dist-clean
: busybox-distclean dialog-distclean gen_init_cpio-distclean initramfs-distclean
37 @if
[ "$$UID" != "0" ]; then \
38 echo
"You need to be root to do this."; \
39 echo
"Now you should run 'make initramfs' as root to finish compilation or 'sudo make initramfs'."; \
43 $(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
:
44 wget
-P
$(WORK
) -c http
://busybox.net
/downloads
/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
46 $(WORK
)/busybox-
$(BUSYBOX_VERSION
): $(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
$(PWD
)/busybox-
$(BUSYBOX_VERSION
).config
47 tar -C
$(WORK
) -xvjf
$(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
48 cp
-v
$(PWD
)/busybox-
$(BUSYBOX_VERSION
).config
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)/.config
49 touch
$(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
51 $(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/bin
/busybox
: $(WORK
)/busybox-
$(BUSYBOX_VERSION
)
52 export PATH
=$(CROSSTOOLS
)/bin
:$$PATH && \
53 export LD_LIBRARY_PATH
=$(CROSSTOOLS
)/lib
:$$LD_LIBRARY_PATH && \
54 make
-C
$(WORK
)/busybox-
$(BUSYBOX_VERSION
) ARCH
=arm CROSS_COMPILE
=$(TARGET
)- install && \
55 install -D
-m
0755 $(WORK
)/busybox-
$(BUSYBOX_VERSION
)/examples
/udhcp
/simple.script
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/usr
/share
/udhcpc
/default.script
&& \
56 $(TARGET
)-strip $(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/bin
/busybox
&& \
57 touch
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/bin
/busybox
59 busybox
: $(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/bin
/busybox
62 rm -vrf
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)
64 busybox-distclean
: busybox-clean
65 rm -vf
$(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
67 $(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
:
68 wget
-P
$(WORK
) -c
$(DIALOG_SOURCE
)
70 $(WORK
)/dialog-
$(DIALOG_VERSION
): $(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
71 tar -C
$(WORK
) -xvzf
$(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
72 touch
$(WORK
)/dialog-
$(DIALOG_VERSION
)
74 $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
: $(WORK
)/dialog-
$(DIALOG_VERSION
)
75 export PATH
=$(CROSSTOOLS
)/bin
:$$PATH && \
76 export LD_LIBRARY_PATH
=$(CROSSTOOLS
)/lib
:$$LD_LIBRARY_PATH && \
77 cd
$(WORK
)/dialog-
$(DIALOG_VERSION
) && \
78 .
/configure
--build
=$(BUILD
) --host
=$(TARGET
) --prefix=/usr
--with-ncursesw
&& \
79 find
-type f
-name
'makefile' \
80 -exec sed
-e
"s|-I/usr|-I$(CLFS)/usr|g" -e
"s|-L/usr|-L$(CLFS)/usr|g" -i
{} \
; && \
81 make CC
="$(TARGET)-gcc -static" && \
82 make DESTDIR
=$(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
install && \
83 $(TARGET
)-strip $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
&& \
84 touch
$(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
86 dialog
: $(NCURSES_HEADER
) $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
89 rm -vrf
$(WORK
)/dialog-
$(DIALOG_VERSION
)
91 dialog-distclean
: dialog-clean
92 rm -vf
$(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
94 $(WORK
)/gen_init_cpio
: $(WORK
)/gen_init_cpio.c
96 $(CC
) $(CFLAGS
) -Wall
-o gen_init_cpio gen_init_cpio.c
98 gen_init_cpio
: $(WORK
)/gen_init_cpio
101 rm -rf
$(WORK
)/gen_init_cpio
103 gen_init_cpio-distclean
: gen_init_cpio-clean
105 $(WORK
)/initramfs.cpio.gz-
$(KERNEL_VERSION
): check-root busybox dialog
$(TOPDIR
)/filesystem
$(WORK
)/gen_init_cpio
$(WORK
)/initramfs.lst
106 mkdir
-p
$(WORK
)/mnt
/{etc
,lib
,usr
/share
/terminfo
}
107 cp
-dRv
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/* $(WORK
)/mnt
108 install -v
-m
0755 $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
$(WORK
)/mnt
/usr
/bin
109 cp
-dRv
$(CLFS
)/lib
/libnss_
{files
*,dns
*} $(CLFS
)/lib
/libresolv
* $(WORK
)/mnt
/lib
110 cp
-dRv
$(CLFS
)/usr
/share
/terminfo
/v
$(WORK
)/mnt
/usr
/share
/terminfo
111 install -v
-m
0644 $(TOPDIR
)/filesystem
/{fstab
,inittab
,profile
,protocols
,*.conf
} $(WORK
)/mnt
/etc
112 install -v
-m
0755 $(TOPDIR
)/filesystem
/rc
$(WORK
)/mnt
/etc
113 install -v
-m
0755 $(TOPDIR
)/filesystem
/{setup
,crux
} $(WORK
)/mnt
/usr
/bin
114 /sbin
/ldconfig
-r
$(WORK
)/mnt
116 sed
-e
"s/#KERNEL_VERSION#/$(KERNEL_VERSION)/g; s/#BUSYBOX_VERSION#/$(BUSYBOX_VERSION)/g" \
117 $(WORK
)/initramfs.lst
> $(WORK
)/initramfs.lst-sed
&& \
118 $(WORK
)/gen_init_cpio
$(WORK
)/initramfs.lst-sed | cpio
-id
&& \
119 find
* | cpio
-H newc
-o
> $(WORK
)/initramfs.cpio
&& \
120 gzip
-v9
$(WORK
)/initramfs.cpio
121 mv
$(WORK
)/initramfs.cpio.gz
{,-$(KERNEL_VERSION
)}
124 initramfs
: $(WORK
)/initramfs.cpio.gz-
$(KERNEL_VERSION
)
127 rm -rf
$(WORK
)/initramfs-
$(KERNEL_VERSION
) $(WORK
)/mnt
$(WORK
)/initramfs.cpio.gz-
$(KERNEL_VERSION
)
129 initramfs-distclean
: initramfs-clean