uwu

hardware bitcoin wallet software and build system
git clone https://git.parazyd.org/uwu
Log | Files | Refs | README | LICENSE

Makefile (1771B)


      1 .POSIX:
      2 
      3 # Copyright (c) 2020-2021 Ivan J. <parazyd@dyne.org>
      4 # This file is part of uwu.
      5 # See LICENSE file for copyright and license details.
      6 
      7 include config.mk
      8 
      9 BINS = qemu-wrapper install.sh
     10 BOOT_BINS = \
     11 	rpi-boot/upstream/kernel.img \
     12 	rpi-boot/upstream/bcm2835-rpi-zero.dtb \
     13 	rpi-boot/upstream/initramfs.cpio
     14 
     15 INIT_BINS = initramfs/bin
     16 
     17 all: $(BINS) $(KERNEL_BINS) $(ALPINE_BINS) $(BUSYBOX_BINS) $(ELECTRUM_BINS) $(BOOT_BINS)
     18 
     19 include electrum.mk
     20 include alpine.mk
     21 include busybox.mk
     22 include kernel.mk
     23 include chroot.mk
     24 
     25 clean:
     26 	rm -rf $(BINS) $(BOOT_BINS) $(INIT_BINS) rpi-boot/filesystem.squashfs \
     27 		$(IMAGE) qemu-wrapper.c
     28 
     29 distclean: clean
     30 	rm -rf $(ALPINE_BINS) $(BUSYBOX_BINS) $(CHROOT_BINS) $(KERNEL_BINS) \
     31 		$(ELECTRUM_BINS)
     32 
     33 qemu-wrapper.c: qemu-wrapper.c.in
     34 	sed -e 's,@QEMU_ARM@,$(QEMU_ARM),g' < $@.in > $@
     35 
     36 qemu-wrapper: qemu-wrapper.c
     37 	$(CC) -static $@.c -O3 -s -o $@
     38 
     39 install.sh: install.sh.in
     40 	sed -e 's,@ROOTCREDENTIALS@,$(ROOTCREDENTIALS),g' < $@.in > $@
     41 
     42 initramfs/bin/busybox: $(BUSYBOX_SRC)/busybox
     43 	mkdir -p initramfs/bin
     44 	cp $(BUSYBOX_SRC)/busybox $@
     45 
     46 rpi-boot/filesystem.squashfs: chroot/root/electrum
     47 	mksquashfs chroot $@ -comp xz -Xbcj arm -noappend
     48 
     49 rpi-boot/upstream/initramfs.cpio: initramfs/bin/busybox initramfs/init
     50 	( cd initramfs && find -print0 | cpio --null -oV --format=newc > ../$@ )
     51 
     52 rpi-boot/upstream/kernel.img: $(KERNEL_SRC)/arch/arm/boot/zImage
     53 	cp $(KERNEL_SRC)/arch/arm/boot/zImage $@
     54 
     55 rpi-boot/upstream/bcm2835-rpi-zero.dtb: $(KERNEL_SRC)/arch/arm/boot/dts/bcm2835-rpi-zero.dtb
     56 	cp $(KERNEL_SRC)/arch/arm/boot/dts/bcm2835-rpi-zero.dtb $@
     57 
     58 image: $(IMAGE)
     59 
     60 $(IMAGE): rpi-boot/filesystem.squashfs $(BOOT_BINS)
     61 	( cd rpi-boot && find -print0 | cpio --null -oV --format=newc > ../$@)
     62 
     63 .PHONY: all clean distclean image