Skip to content

Commit 394a24f

Browse files
committed
Refactored Makefile
1 parent 7b7dea6 commit 394a24f

File tree

1 file changed

+41
-29
lines changed

1 file changed

+41
-29
lines changed

Makefile

+41-29
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,28 @@
11
S3_TARGET ?= s3://$(shell whoami)/
22
BUSYBOX_URL ?= http://launchpadlibrarian.net/181784411/busybox-static_1.22.0-8ubuntu1_armhf.deb
3+
KERNEL_URL ?= http://ports.ubuntu.com/ubuntu-ports/dists/lucid/main/installer-armel/current/images/versatile/netboot/vmlinuz
4+
CMDLINE ?= 'root=/dev/ram'
35

4-
uInitrd: initrd.gz
5-
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d $< $@
6-
7-
initrd.gz: tree tree/init tree/functions tree/bin/busybox tree/bin/sh
8-
cd tree && find . -print0 | cpio --null -ov --format=newc | gzip -9 > $(PWD)/$@
9-
10-
tree/bin/sh:
11-
cd tree && mkdir -p bin sbin etc proc sys newroot usr/bin usr/sbin
12-
ln -s busybox tree/bin/sh || true
13-
14-
tree/bin/busybox:
15-
mkdir -p $(shell dirname $@)
16-
docker run -it --rm \
17-
-v $(PWD)/tree/bin:/host/bin \
18-
busybox \
19-
/bin/sh -xec ' \
20-
cd /tmp && \
21-
wget $(BUSYBOX_URL) -O busybox.deb && \
22-
ar x busybox.deb && \
23-
xz -d data.tar.xz && \
24-
tar xf data.tar && \
25-
cp bin/busybox /host/bin/busybox \
26-
'
27-
chmod +x $@
286

29-
.PHONY: publish_on_s3 qemu dist dist_do dist_teardown
7+
.PHONY: publish_on_s3 qemu dist dist_do dist_teardown all
308

9+
# Phonies
10+
all: uInitrd
3111

3212
qemu: vmlinuz initrd.gz
33-
qemu-system-arm -M versatilepb -cpu cortex-a8 -kernel ./vmlinuz -initrd ./initrd.gz -m 256 -append 'root=/dev/ram'
13+
qemu-system-arm \
14+
-M versatilepb \
15+
-cpu cortex-a8 \
16+
-kernel ./vmlinuz \
17+
-initrd ./initrd.gz \
18+
-m 256 \
19+
-append $(CMDLINE)
3420

3521
publish_on_s3: uInitrd initrd.gz
3622
for file in $<; do \
3723
s3cmd put --acl-public $$file $(S3_TARGET); \
3824
done
3925

40-
4126
dist:
4227
$(MAKE) dist_do || $(MAKE) dist_teardown
4328

@@ -53,6 +38,33 @@ dist_do:
5338
dist_teardown:
5439
git checkout master
5540

41+
42+
# Files
5643
vmlinuz:
57-
#wget -O $@ http://ports.ubuntu.com/ubuntu-ports/dists/utopic/main/installer-armhf/current/images/generic/netboot/vmlinuz
58-
wget -O $@ http://ports.ubuntu.com/ubuntu-ports/dists/lucid/main/installer-armel/current/images/versatile/netboot/vmlinuz
44+
wget -O $@ $(KERNEL_URL)
45+
46+
47+
uInitrd: initrd.gz
48+
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d $< $@
49+
50+
initrd.gz: tree tree/init tree/functions tree/bin/busybox tree/bin/sh
51+
cd tree && find . -print0 | cpio --null -ov --format=newc | gzip -9 > $(PWD)/$@
52+
53+
tree/bin/sh:
54+
cd tree && mkdir -p bin sbin etc proc sys newroot usr/bin usr/sbin
55+
ln -s busybox tree/bin/sh || true
56+
57+
tree/bin/busybox:
58+
mkdir -p $(shell dirname $@)
59+
docker run -it --rm \
60+
-v $(PWD)/tree/bin:/host/bin \
61+
busybox \
62+
/bin/sh -xec ' \
63+
cd /tmp && \
64+
wget $(BUSYBOX_URL) -O busybox.deb && \
65+
ar x busybox.deb && \
66+
xz -d data.tar.xz && \
67+
tar xf data.tar && \
68+
cp bin/busybox /host/bin/busybox \
69+
'
70+
chmod +x $@

0 commit comments

Comments
 (0)