91 lines
3 KiB
Makefile
91 lines
3 KiB
Makefile
COMPILER_BIN := $(shell pwd)/buildroot/output/host/bin
|
|
COMMON_MAKEOPTS := CROSS_COMPILE=${COMPILER_BIN}/arm-buildroot-linux-musleabi-
|
|
LINUX_MAKEOPTS := ${COMMON_MAKEOPTS} ARCH=arm
|
|
AT91BOOTSTRAP := ${COMMON_MAKEOPTS}
|
|
|
|
.PHONY: sdcard qspi
|
|
sdcard: output/rootfs.tar output/sd-kernel output/sd-boot.bin output/devicetree.dtb
|
|
@echo 'SD card things generated...'
|
|
@echo 'im not gonna bother making an image to write to the sd card'
|
|
@echo 'just copy sd-kernel and sd-boot.bin (rename to boot.bin) to the FAT partition'
|
|
@echo 'and extract rootfs.tar to the F2FS partition'
|
|
@echo 'if using the SD card image to write the QSPI image, make sure to copy those files too; xip-kernel and xip-boot.bin'
|
|
|
|
qspi: output/rootfs.cramfs output/xip-kernel output/xip-boot.bin output/devicetree.dtb
|
|
@echo 'QSPI things generated...'
|
|
@echo 'no image generated tho, youre on your own for that'
|
|
@echo 'as defined in the device tree, xip-boot.bin goes to 0, xip-kernel goes to 1, devicetree.dtb goes to 2, and rootfs.cramfs goes to 3.'
|
|
|
|
|
|
|
|
|
|
|
|
### LINUX
|
|
linux/arch/arm/boot/bzImage: .linux-bz.config .has_toolchain
|
|
output/sd-kernel: linux/arch/arm/boot/bzImage
|
|
|
|
linux/arch/arm/boot/xipImage: linux.config .has_toolchain
|
|
output/xip-kernel: linux/arch/arm/boot/xipImage
|
|
|
|
COPY_TARGETS+= output/sd-kernel output/xip-kernel
|
|
|
|
linux/arch/arm/boot/bzImage linux/arch/arm/boot/xipImage:
|
|
make -C linux ${LINUX_MAKEOPTS} KBUILD_CONFIG=../$< $@
|
|
|
|
.linux-bz.config: linux.config
|
|
sed -e 's/^CONFIG_XIP_KERNEL=y$/CONFIG_XIP_KERNEL=n/' $< > $@
|
|
make -C linux ${LINUX_MAKEOPTS} KBUILD_CONFIG=../$@ olddefconfig
|
|
|
|
.PHONY: linux-nconfig
|
|
linux-nconfig:
|
|
make -C linux ${LINUX_MAKEOPTS} KBUILD_CONFIG=../linux.config nconfig
|
|
|
|
|
|
### BUILDROOT
|
|
.has_toolchain: buildroot/.config
|
|
@test -e .has_toolchain && \
|
|
echo '.has_toolchain exists, not remaking toolchain.' && \
|
|
echo 'if you need to update the toolchain, remove the file.' || \
|
|
make -C buildroot ${BUILDROOT_MAKEOPTS} toolchain
|
|
touch .has_toolchain
|
|
|
|
|
|
output/rootfs.tar: buildroot/output/images/rootfs.tar
|
|
COPY_TARGETS+= output/rootfs.tar
|
|
|
|
# copy buildroot config
|
|
buildroot/.config: buildroot.config
|
|
COPY_TARGETS+= buildroot/.config
|
|
|
|
buildroot/output/images/rootfs.tar: buildroot/.config
|
|
make -C buildroot ${BUILDROOT_MAKEOPTS}
|
|
|
|
.PHONY: buildroot-nconfig
|
|
buildroot-nconfig: buildroot/.config
|
|
make -C buildroot ${BUILDROOT_MAKEOPTS} nconfig
|
|
cp buildroot/.config buildroot.config
|
|
|
|
|
|
### AT91BOOTSTRAP
|
|
output/sd-boot.bin: at91bootstrap-sd.config .has_toolchain
|
|
output/xip-boot.bin: at91bootstrap-xip.config .has_toolchain
|
|
|
|
output/sd-boot.bin output/xip-boot.bin:
|
|
cp $< at91bootstrap/.config
|
|
make -C at91bootstrap ${AT91BOOTSTRAP_MAKEOPTS} at91bootstrap/build/binaries/boot.bin
|
|
cp at91bootstrap/build/binaries/boot.bin $@
|
|
|
|
.PHONY: at91bootstrap-menuconfig-xip at91bootstrap-menuconfig-sd
|
|
at91bootstrap-menuconfig-xip: at91bootstrap-xip.config
|
|
at91bootstrap-menuconfig-sd: at91bootstrap-sd.config
|
|
|
|
at91bootstrap-menuconfig-xip at91bootstrap-menuconfig-sd:
|
|
cp $< at91bootstrap/.config
|
|
make -C at91bootstrap ${AT91BOOTSTRAP_MAKEOPTS} menuconfig
|
|
cp at91bootstrap/.config $<
|
|
|
|
|
|
|
|
|
|
$(COPY_TARGETS):
|
|
cp $< $@
|