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 E2FSPROGS_VERSION
= 1.42.5
19 E2FSPROGS_SOURCE
= http
://downloads.sourceforge.net
/project
/e2fsprogs
/e2fsprogs
/v
$(E2FSPROGS_VERSION
)/e2fsprogs-
$(E2FSPROGS_VERSION
).
tar.gz
21 DIALOG_VERSION
= 1.2-20130523
22 DIALOG_SOURCE
= ftp
://invisible-island.net
/dialog
/dialog-
$(DIALOG_VERSION
).tgz
24 NCURSES_HEADER
= $(CLFS
)/usr
/include/ncurses.h
26 .PHONY
: all check-root busybox e2fsprogs dialog gen_init_cpio initramfs
clean distclean
30 clean: busybox-clean e2fsprogs-clean dialog-clean gen_init_cpio-clean initramfs-clean
32 distclean: busybox-distclean e2fsprogs-distclean dialog-distclean gen_init_cpio-distclean initramfs-distclean
35 @if
[ "$$UID" != "0" ]; then \
36 echo
"You need to be root to do this."; \
37 echo
"Now you should run 'make initramfs' as root to finish compilation or 'sudo make initramfs'."; \
41 $(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
:
42 wget
-P
$(WORK
) -c
$(BUSYBOX_SOURCE
)
44 $(WORK
)/busybox-
$(BUSYBOX_VERSION
): $(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
$(TOPDIR
)/busybox-
$(BUSYBOX_VERSION
).config
$(WORK
)/fix-resource_header.patch
45 tar -C
$(WORK
) -xvjf
$(WORK
)/busybox-
$(BUSYBOX_VERSION
).
tar.bz2
46 cd
$(WORK
)/busybox-
$(BUSYBOX_VERSION
) && \
47 patch
-p1
-i
$(WORK
)/fix-resource_header.patch
48 cp
-v
$(TOPDIR
)/busybox-
$(BUSYBOX_VERSION
).config
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)/.config
49 touch
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)
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
-j1
-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
)/e2fsprogs-
$(E2FSPROGS_VERSION
).
tar.gz
:
68 wget
-P
$(WORK
) -c
$(E2FSPROGS_SOURCE
)
70 $(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
): $(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
).
tar.gz
71 tar -C
$(WORK
) -xvzf
$(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
).
tar.gz
72 touch
$(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
)
74 $(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
)/misc
/mke2fs
: $(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
)
75 export PATH
=$(CROSSTOOLS
)/bin
:$$PATH && \
76 export LD_LIBRARY_PATH
=$(CROSSTOOLS
)/lib
:$$LD_LIBRARY_PATH && \
77 cd
$(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
) && \
78 .
/configure
--build
=$(BUILD
) --host
=$(TARGET
) --prefix=/usr
--with-root-prefix
= \
79 --mandir=/usr
/man
--disable-symlink-install
--disable-nls
--disable-compression \
80 --disable-htree
--disable-elf-shlibs
--disable-bsd-shlibs
--disable-profile \
81 --disable-checker
--disable-jbd-debug
--disable-blkid-debug
--disable-testio-debug \
82 --enable-libuuid
--enable-libblkid
--disable-libquota
--disable-debugfs
--disable-imager \
83 --disable-resizer
--disable-defrag
--disable-fsck
--disable-e2initrd-helper \
84 --disable-tls
--disable-rpath
&& \
85 make V
=1 CFLAGS
="$(CFLAGS) -static" LDFLAGS
="$(LDFLAGS) -static" && \
86 $(TARGET
)-strip $(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
)/misc
/mke2fs
&& \
87 touch
$(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
)/misc
/mke2fs
89 e2fsprogs
: $(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
)/misc
/mke2fs
92 rm -vrf
$(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
)
95 rm -vf
$(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
).
tar.bz2
97 $(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
:
98 wget
-P
$(WORK
) -c
$(DIALOG_SOURCE
)
100 $(WORK
)/dialog-
$(DIALOG_VERSION
): $(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
101 tar -C
$(WORK
) -xvzf
$(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
102 touch
$(WORK
)/dialog-
$(DIALOG_VERSION
)
104 $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
: $(WORK
)/dialog-
$(DIALOG_VERSION
)
105 export PATH
=$(CROSSTOOLS
)/bin
:$$PATH && \
106 export LD_LIBRARY_PATH
=$(CROSSTOOLS
)/lib
:$$LD_LIBRARY_PATH && \
107 cd
$(WORK
)/dialog-
$(DIALOG_VERSION
) && \
108 .
/configure
--build
=$(BUILD
) --host
=$(TARGET
) --prefix=/usr
--with-ncursesw
&& \
109 find
-type f
-name
'makefile' \
110 -exec sed
-e
"s|-I/usr|-I$(CLFS)/usr|g" -e
"s|-L/usr|-L$(CLFS)/usr|g" -i
{} \
; && \
111 make CC
="$(TARGET)-gcc -static" && \
112 make DESTDIR
=$(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
install && \
113 $(TARGET
)-strip $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
&& \
114 touch
$(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
116 dialog
: $(NCURSES_HEADER
) $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
119 rm -vrf
$(WORK
)/dialog-
$(DIALOG_VERSION
)
121 dialog-distclean
: dialog-clean
122 rm -vf
$(WORK
)/dialog-
$(DIALOG_VERSION
).tgz
124 $(WORK
)/gen_init_cpio
: $(WORK
)/gen_init_cpio.c
126 $(CC
) $(CFLAGS
) -Wall
-o gen_init_cpio gen_init_cpio.c
128 gen_init_cpio
: $(WORK
)/gen_init_cpio
131 rm -rf
$(WORK
)/gen_init_cpio
133 gen_init_cpio-distclean
: gen_init_cpio-clean
138 $(WORK
)/initramfs.cpio
: check-root busybox e2fsprogs dialog
$(WORK
)/mnt gen_init_cpio
$(TOPDIR
)/filesystem
139 install -d
-m
0755 $(WORK
)/mnt
/{mnt
,media
,etc
,dev
,sys
,proc
,lib
,usr
,var
/{log
,lock
,run
},tmp
}
140 mknod
$(WORK
)/mnt
/dev
/console c
5 1 && chmod
666 $(WORK
)/mnt
/dev
/console
141 mknod
$(WORK
)/mnt
/dev
/null c
1 3 && chmod
666 $(WORK
)/mnt
/dev
/null
142 mknod
$(WORK
)/mnt
/dev
/tty c
5 0 && chmod
666 $(WORK
)/mnt
/dev
/tty
143 mkdir
$(WORK
)/mnt
/dev
/rd
&& mknod
$(WORK
)/mnt
/dev
/rd
/0 b
1 0
144 mknod
$(WORK
)/mnt
/dev
/ram0 b
1 0 && chmod
600 $(WORK
)/mnt
/dev
/ram0
145 for i in
0 1 2 3 4 5 6 7; do \
146 mknod
$(WORK
)/mnt
/dev
/tty
$$i c
4 $$i && chmod
666 $(WORK
)/mnt
/dev
/tty
$$i; \
148 cp
-dRv
$(WORK
)/busybox-
$(BUSYBOX_VERSION
)/_install
/* $(WORK
)/mnt
149 install -v
-m
0755 $(WORK
)/e2fsprogs-
$(E2FSPROGS_VERSION
)/misc
/mke2fs
$(WORK
)/mnt
/sbin
150 for i in
2 3 4 4dev
; do \
151 ln
-s mke2fs
$(WORK
)/mnt
/sbin
/mkfs.ext
$$i; \
153 install -v
-m
0755 $(WORK
)/dialog-
$(DIALOG_VERSION
)/_install
/usr
/bin
/dialog
$(WORK
)/mnt
/usr
/bin
154 cp
-dRv
$(CLFS
)/lib
/libnss_
{files
*,dns
*} $(CLFS
)/lib
/libresolv
* $(WORK
)/mnt
/lib
155 install -d
$(WORK
)/mnt
/usr
/share
/terminfo
156 cp
-dRv
$(CLFS
)/usr
/share
/terminfo
/v
$(WORK
)/mnt
/usr
/share
/terminfo
157 install -v
-m
0644 $(TOPDIR
)/filesystem
/{fstab
,inittab
,profile
,protocols
,*.conf
} $(WORK
)/mnt
/etc
158 install -v
-m
0664 $(TOPDIR
)/filesystem
/group
$(WORK
)/mnt
/etc
159 install -v
-m
0600 $(TOPDIR
)/filesystem
/passwd
$(WORK
)/mnt
/etc
160 install -v
-m
0400 $(TOPDIR
)/filesystem
/shadow
$(WORK
)/mnt
/etc
161 install -v
-m
0755 $(TOPDIR
)/filesystem
/rc
$(WORK
)/mnt
/etc
&& \
162 install -v
-m
0755 $(TOPDIR
)/filesystem
/{setup
,setup-chroot
,crux
} $(WORK
)/mnt
/usr
/bin
&& \
163 ln
-s bin
/busybox
$(WORK
)/mnt
/init
164 /sbin
/ldconfig
-r
$(WORK
)/mnt
165 cd
$(WORK
)/mnt
&& find . | cpio
-o
-H newc
> $(WORK
)/initramfs.cpio
166 touch
$(WORK
)/initramfs.cpio
168 initramfs
: $(WORK
)/initramfs.cpio
171 rm -rf
$(WORK
)/initramfs
* $(WORK
)/mnt
173 initramfs-distclean
: initramfs-clean