7 include $(TOPDIR
)/..
/toolchain
/vars.mk
9 TARGET
= arm-crux-linux-gnueabihf
12 CLFS
= $(TOPDIR
)/..
/toolchain
/clfs
13 CROSSTOOLS
= $(TOPDIR
)/..
/toolchain
/crosstools
15 BUSYBOX_VERSION
= 1.21.1
16 BUSYBOX_SOURCE
= http
://busybox.net
/downloads
/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
18 DIALOG_VERSION
= 1.2-20130523
19 DIALOG_SOURCE
= ftp
://invisible-island.net
/dialog
/dialog-
$(DIALOG_VERSION
).tgz
21 NCURSES_HEADER
= $(CLFS
)/usr
/include/ncurses.h
23 .PHONY
: all check-root busybox dialog gen_init_cpio initramfs
clean distclean
27 clean: busybox-clean dialog-clean gen_init_cpio-clean initramfs-clean
29 distclean: busybox-distclean dialog-distclean gen_init_cpio-distclean initramfs-distclean
32 @if
[ "$$UID" != "0" ]; then \
33 echo
"You need to be root to do this."; \
34 echo
"Now you should run 'make initramfs' as root to finish compilation or 'sudo make initramfs'."; \
38 $(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
:
39 wget
-P
$(WORK
) -c
$(BUSYBOX_SOURCE
)
41 $(WORK
)/busybox-
$(BUSYBOX_VERSION
): $(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
$(TOPDIR
)/busybox-
$(BUSYBOX_VERSION
).config
$(WORK
)/fix-resource_header.patch
42 tar -C
$(WORK
) -xvjf
$(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
43 cd
$(WORK
)/busybox-
$(BUSYBOX_VERSION
) && \
44 patch
-p1
-i
$(WORK
)/fix-resource_header.patch
45 cp
-v
$(TOPDIR
)/busybox-
$(BUSYBOX_VERSION
).config
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)/.config
46 touch
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)
48 $(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/bin
/busybox
: $(WORK
)/busybox-
$(BUSYBOX_VERSION
)
49 export PATH
=$(CROSSTOOLS
)/bin
:$$PATH && \
50 export LD_LIBRARY_PATH
=$(CROSSTOOLS
)/lib
:$$LD_LIBRARY_PATH && \
51 make
-C
$(WORK
)/busybox-
$(BUSYBOX_VERSION
) ARCH
=arm CROSS_COMPILE
=$(TARGET
)- install && \
52 install -D
-m
0755 $(WORK
)/busybox-
$(BUSYBOX_VERSION
)/examples
/udhcp
/simple.script
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/usr
/share
/udhcpc
/default.script
&& \
53 $(TARGET
)-strip $(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/bin
/busybox
&& \
54 touch
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/bin
/busybox
56 busybox
: $(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/bin
/busybox
59 rm -vrf
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)
61 busybox-distclean
: busybox-clean
62 rm -vf
$(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
64 $(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
:
65 wget
-P
$(WORK
) -c
$(DIALOG_SOURCE
)
67 $(WORK
)/dialog-
$(DIALOG_VERSION
): $(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
68 tar -C
$(WORK
) -xvzf
$(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
69 touch
$(WORK
)/dialog-
$(DIALOG_VERSION
)
71 $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
: $(WORK
)/dialog-
$(DIALOG_VERSION
)
72 export PATH
=$(CROSSTOOLS
)/bin
:$$PATH && \
73 export LD_LIBRARY_PATH
=$(CROSSTOOLS
)/lib
:$$LD_LIBRARY_PATH && \
74 cd
$(WORK
)/dialog-
$(DIALOG_VERSION
) && \
75 .
/configure
--build
=$(BUILD
) --host
=$(TARGET
) --prefix=/usr
--with-ncursesw
&& \
76 find
-type f
-name
'makefile' \
77 -exec sed
-e
"s|-I/usr|-I$(CLFS)/usr|g" -e
"s|-L/usr|-L$(CLFS)/usr|g" -i
{} \
; && \
78 make CC
="$(TARGET)-gcc -static" && \
79 make DESTDIR
=$(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
install && \
80 $(TARGET
)-strip $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
&& \
81 touch
$(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
83 dialog
: $(NCURSES_HEADER
) $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
86 rm -vrf
$(WORK
)/dialog-
$(DIALOG_VERSION
)
88 dialog-distclean
: dialog-clean
89 rm -vf
$(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
91 $(WORK
)/gen_init_cpio
: $(WORK
)/gen_init_cpio.c
93 $(CC
) $(CFLAGS
) -Wall
-o gen_init_cpio gen_init_cpio.c
95 gen_init_cpio
: $(WORK
)/gen_init_cpio
98 rm -rf
$(WORK
)/gen_init_cpio
100 gen_init_cpio-distclean
: gen_init_cpio-clean
105 $(WORK
)/initramfs.cpio
: check-root busybox dialog
$(WORK
)/mnt gen_init_cpio
$(TOPDIR
)/filesystem
106 install -d
-m
0755 $(WORK
)/mnt
/{mnt
,media
,etc
,dev
,sys
,proc
,lib
,usr
,var
/{log
,lock
,run
},tmp
}
107 mknod
$(WORK
)/mnt
/dev
/console c
5 1 && chmod
666 $(WORK
)/mnt
/dev
/console
108 mknod
$(WORK
)/mnt
/dev
/null c
1 3 && chmod
666 $(WORK
)/mnt
/dev
/null
109 mknod
$(WORK
)/mnt
/dev
/tty c
5 0 && chmod
666 $(WORK
)/mnt
/dev
/tty
110 mkdir
$(WORK
)/mnt
/dev
/rd
&& mknod
$(WORK
)/mnt
/dev
/rd
/0 b
1 0
111 mknod
$(WORK
)/mnt
/dev
/ram0 b
1 0 && chmod
600 $(WORK
)/mnt
/dev
/ram0
112 for i in
0 1 2 3 4 5 6 7; do \
113 mknod
$(WORK
)/mnt
/dev
/tty
$$i c
4 $$i && chmod
666 $(WORK
)/mnt
/dev
/tty
$$i; \
115 cp
-dRv
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/* $(WORK
)/mnt
116 install -v
-m
0755 $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
$(WORK
)/mnt
/usr
/bin
117 cp
-dRv
$(CLFS
)/lib
/libnss_
{files
*,dns
*} $(CLFS
)/lib
/libresolv
* $(WORK
)/mnt
/lib
118 install -d
$(WORK
)/mnt
/usr
/share
/terminfo
119 cp
-dRv
$(CLFS
)/usr
/share
/terminfo
/v
$(WORK
)/mnt
/usr
/share
/terminfo
120 install -v
-m
0644 $(TOPDIR
)/filesystem
/{fstab
,inittab
,profile
,protocols
,*.conf
} $(WORK
)/mnt
/etc
121 install -v
-m
0664 $(TOPDIR
)/filesystem
/group
$(WORK
)/mnt
/etc
122 install -v
-m
0600 $(TOPDIR
)/filesystem
/passwd
$(WORK
)/mnt
/etc
123 install -v
-m
0400 $(TOPDIR
)/filesystem
/shadow
$(WORK
)/mnt
/etc
124 install -v
-m
0755 $(TOPDIR
)/filesystem
/rc
$(WORK
)/mnt
/etc
&& \
125 install -v
-m
0755 $(TOPDIR
)/filesystem
/{setup
,setup-chroot
,crux
} $(WORK
)/mnt
/usr
/bin
&& \
126 ln
-s bin
/busybox
$(WORK
)/mnt
/init
127 /sbin
/ldconfig
-r
$(WORK
)/mnt
128 cd
$(WORK
)/mnt
&& find . | cpio
-o
-H newc
> $(WORK
)/initramfs.cpio
129 touch
$(WORK
)/initramfs.cpio
131 initramfs
: $(WORK
)/initramfs.cpio
134 rm -rf
$(WORK
)/initramfs
* $(WORK
)/mnt
136 initramfs-distclean
: initramfs-clean