pi3-aoe

ATA over Ethernet setup for Raspberry Pi 3
git clone https://git.parazyd.org/pi3-aoe
Log | Files | Refs | README | LICENSE

Makefile (2498B)


      1 .POSIX:
      2 
      3 TC="aarch64-linux-gnu-"
      4 
      5 KERNEL_URL = https://github.com/raspberrypi/linux
      6 KERNEL_BRANCH = rpi-5.11.y
      7 KERNEL_SRC = linux-raspberrypi
      8 IMAGEGZ = $(KERNEL_SRC)/arch/arm64/boot/Image.gz
      9 
     10 FIRMWARE_URL = https://github.com/raspberrypi/firmware
     11 FIRMWARE_BRANCH = master
     12 FIRMWARE_SRC = firmware
     13 
     14 AOE_URL = https://github.com/OpenAoE/aoetools
     15 AOE_BRANCH = master
     16 AOE_SRC = aoetools
     17 
     18 BUSYBOX_URL = https://git.busybox.net/busybox
     19 BUSYBOX_BRANCH = 1_32_1
     20 BUSYBOX_SRC = busybox
     21 
     22 all: boot/kernel8.img bin/aoe-stat boot/bootcode.bin bin/busybox
     23 
     24 $(KERNEL_SRC):
     25 	git clone --depth 1 -b $(KERNEL_BRANCH) $(KERNEL_URL) $@
     26 
     27 $(FIRMWARE_SRC):
     28 	git clone --depth 1 -b $(FIRMWARE_BRANCH) $(FIRMWARE_URL) $@
     29 
     30 $(AOE_SRC):
     31 	git clone --depth 1 -b $(AOE_BRANCH) $(AOE_URL) $@
     32 
     33 $(BUSYBOX_SRC):
     34 	git clone --depth 1 -b $(BUSYBOX_BRANCH) $(BUSYBOX_URL) $@
     35 
     36 boot/bootcode.bin: $(FIRMWARE_SRC)
     37 	cp $(FIRMWARE_SRC)/boot/start* boot
     38 	cp $(FIRMWARE_SRC)/boot/fixup* boot
     39 	cp $(FIRMWARE_SRC)/boot/LICENCE.broadcom boot
     40 	cp $(FIRMWARE_SRC)/boot/COPYING.linux boot
     41 	cp $(FIRMWARE_SRC)/boot/bootcode.bin boot
     42 
     43 $(IMAGEGZ): $(KERNEL_SRC) pi3.config
     44 	cp -f pi3.config $(KERNEL_SRC)/.config
     45 	$(MAKE) -C $(KERNEL_SRC) ARCH=arm64 CROSS_COMPILE=$(TC) oldconfig
     46 	$(MAKE) -C $(KERNEL_SRC) ARCH=arm64 CROSS_COMPILE=$(TC)
     47 
     48 boot/kernel8.img: $(IMAGEGZ)
     49 	mkdir -p boot/overlays
     50 	cp $(KERNEL_SRC)/arch/arm64/boot/Image.gz $@
     51 	cp $(KERNEL_SRC)/arch/arm64/boot/dts/broadcom/bcm*.dtb boot
     52 	cp $(KERNEL_SRC)/arch/arm64/boot/dts/overlays/*.dtbo boot/overlays
     53 	cp $(KERNEL_SRC)/arch/arm64/boot/dts/overlays/README boot/overlays
     54 
     55 bin/aoe-stat: $(AOE_SRC)
     56 	sed -e 's@^CFLAGS =.*@CFLAGS = -Os -s -static@' -i $(AOE_SRC)/Makefile
     57 	sed -e 's@^SBINDIR =.*@SBINDIR = $${PREFIX}/bin@' -i $(AOE_SRC)/Makefile
     58 	$(MAKE) -C $(AOE_SRC) CC=$(TC)gcc PREFIX=$(CURDIR)
     59 	$(MAKE) -C $(AOE_SRC) CC=$(TC)gcc PREFIX=$(CURDIR) install
     60 	rm -rf usr
     61 
     62 bin/busybox: $(BUSYBOX_SRC)
     63 	cp busybox.config $(BUSYBOX_SRC)/.config
     64 	$(MAKE) -C $(BUSYBOX_SRC) ARCH=arm64 CROSS_COMPILE=$(TC) busybox
     65 	cp $(BUSYBOX_SRC)/busybox $@
     66 
     67 initramfs.gz: bin/aoe-stat bin/busybox
     68 	mkdir -p initramfs/dev initramfs/proc initramfs/sys
     69 	cp init initramfs
     70 	cp -r bin initramfs
     71 	cp -a /dev/console /dev/random /dev/tty /dev/urandom initramfs/dev
     72 	( cd initramfs ; find . | cpio -o -H newc | gzip -c9 > ../$@ )
     73 
     74 install: all initramfs.gz
     75 ifeq ($(DESTDIR),)
     76 	@echo "You need to set DESTDIR. See README.md for more information."
     77 	@exit 1
     78 endif
     79 	cp -r boot/* initramfs.gz $(DESTDIR)
     80 
     81 .PHONY: all install