commit 8ec34553548b3118a7b2367f1f36c21d625996fe
parent 95fdf6f8911f2e13f83c115c353d77cbae6bd735
Author: parazyd <parazyd@dyne.org>
Date: Tue, 2 Feb 2021 22:25:56 +0100
Create cpio image with "make image".
Diffstat:
3 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
@@ -22,8 +22,8 @@ include busybox.mk
include kernel.mk
clean:
- rm -rf $(BINS) $(BOOT_BINS) $(INIT_BINS) filesystem.squashfs \
- uwu-$(VERSION).img qemu-wrapper.c
+ rm -rf $(BINS) $(BOOT_BINS) $(INIT_BINS) rpi-boot/filesystem.squashfs \
+ $(IMAGE) qemu-wrapper.c
distclean: clean
rm -rf $(ALPINE_BINS) $(BUSYBOX_BINS) $(CHROOT_BINS) $(KERNEL_BINS)
@@ -44,7 +44,7 @@ initramfs/bin/busybox: $(BUSYBOX_SRC)/busybox
mkdir -p initramfs/bin
cp $(BUSYBOX_SRC)/busybox $@
-filesystem.squashfs: chroot/usr/bin/electrum
+rpi-boot/filesystem.squashfs: chroot/usr/bin/electrum
mksquashfs chroot $@ -comp xz -noappend
rpi-boot/upstream/initramfs.cpio: initramfs/bin/busybox initramfs/init
@@ -56,4 +56,9 @@ rpi-boot/upstream/kernel.img: $(KERNEL_SRC)/arch/arm/boot/zImage
rpi-boot/upstream/bcm2835-rpi-zero.dtb: $(KERNEL_SRC)/arch/arm/boot/dts/bcm2835-rpi-zero.dtb
cp $(KERNEL_SRC)/arch/arm/boot/dts/bcm2835-rpi-zero.dtb $@
-.PHONY: all clean distclean
+image: $(IMAGE)
+
+$(IMAGE): rpi-boot/filesystem.squashfs $(BOOT_BINS)
+ ( cd rpi-boot && find -print0 | cpio --null -oV --format=newc > ../$@)
+
+.PHONY: all clean distclean image
diff --git a/README.md b/README.md
@@ -103,17 +103,9 @@ To compile uwu and get the resulting cpio archive, we can issue
```
$ make -j$(nproc)
-$ make -j$(nproc) image
+$ sudo make -j$(nproc) image
```
-Some commands need `sudo` permissions, so be sure the user you're
-building with is able to use sudo. **Do not build as root!**
-
-**Sidenote:** If the build seems to be hanging, it might be waiting for
-you to input a sudo password. Try inputting it and pressing `Enter` to
-continue. Otherwise, you may want to set up a `NOPASSWD` entry in
-sudoers, or something similar to prolong the timeout.
-
This process can take 20 minutes of crunching, depending on your
hardware. When this is issued, the build system will start downloading
the necessary source code and binaries. It will be compiling the Linux
diff --git a/chroot.mk b/chroot.mk
@@ -12,7 +12,7 @@ chroot/bin/busybox: $(ALPINE_TAR) $(ALPINE_SIG)
mkdir -p chroot
( cd chroot && tar xf ../$(ALPINE_TAR) )
-chroot/bin/electrum: chroot/bin/busybox qemu-wrapper
+chroot/usr/bin/electrum: chroot/bin/busybox qemu-wrapper
./devprocsys.sh mount chroot
cp install.sh chroot/install.sh
cp qemu-wrapper chroot