From a9ef380662da3efa382017ff8423f1a894b31bfd Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 6 Feb 2024 13:22:04 +0100 Subject: dynamic linking application starts --- makefile | 75 +++++++++++----------------------------------------------------- 1 file changed, 13 insertions(+), 62 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index 5a9886a..708fdb2 100644 --- a/makefile +++ b/makefile @@ -25,86 +25,37 @@ $(eval $(shell state/gen)) include ./env export -.PHONY: all -all: load_boot load_rootfs +.PHONY: FORCE -.PHONY: sd_format sd_partition -sd_format: state/sdcard_fmt -sd_partition: state/sdcard_part +all: FORCE load_boot load_rootfs -state/container_img: Containerfile - $(CTR) build --tag $(CTR_IMG_TAG) . - touch $@ +include state.mk +include base.mk +include software.mk -state/submodules: - git submodule update --init - touch $@ +build_kernel: FORCE $(KERNEL_FILES) +build_bootloader: FORCE $(BOOTLOADER_FILES) +build_software: FORCE $(SOFTWARE_FILES) -state/sdcard_part: - $(AS_ROOT) util/part $(SDCARD_DISK) - touch $@ - -state/sdcard_fmt: state/sdcard_part - $(eval $(shell state/gen)) - $(AS_ROOT) mkfs.vfat -a -F 16 -n BOOT $(SDCARD_PART_BOOT) - $(AS_ROOT) mkfs.ext4 -F -L ROOTFS $(SDCARD_PART_ROOTFS) - touch $@ - -bootloader/.config: state/submodules state/container_img - $(CTRIZE) $(MAKE) -C bootloader am335x_evm_config -build_bootloader: bootloader/.config state/container_img - $(CTRIZE) $(MAKE) -C bootloader -uboot.env: uboot.txt - $(CTRIZE) bootloader/tools/mkenvimage -p 0x00 -s 0x20000 -o $@ $< -# NOTE: MLO MUST be copied first -BOOTLOADER_FILES += bootloader/MLO -BOOTLOADER_FILES += bootloader/u-boot.img -BOOTLOADER_FILES += bootloader/u-boot.dtb -BOOTLOADER_FILES += uboot.env -$(BOOTLOADER_FILES): build_bootloader - -kernel/.config: state/submodules state/container_img - $(CTRIZE) $(MAKE) -C kernel bb.org_defconfig -build_kernel: kernel/.config state/container_img - $(CTRIZE) $(MAKE) -C kernel zImage am335x-boneblack.dtb -KERNEL_FILES += kernel/arch/$(ARCH)/boot/dts/am335x-boneblack.dtb -KERNEL_FILES += kernel/arch/$(ARCH)/boot/zImage -$(KERNEL_FILES): build_kernel - -busybox/.config: state/submodules state/container_img - $(CTRIZE) $(MAKE) -C busybox defconfig - sed -i 's/^[# ]*CONFIG_STATIC\>.*$$/CONFIG_STATIC=y/' $@ - sed -i 's/^[# ]*CONFIG_PREFIX\>.*$$/CONFIG_PREFIX=".\/rootfs"/' $@ -busybox/busybox: busybox/.config state/container_img - $(CTRIZE) $(MAKE) -C busybox -busybox/_install: busybox/busybox state/container_img - $(CTRIZE) $(MAKE) -C busybox install -build_busybox: busybox/busybox - -# NOTE: ordering is important! -FILES_PART_BOOT += $(BOOTLOADER_FILES) -FILES_PART_BOOT += $(KERNEL_FILES) -.PHONY: load_boot load_rootfs -load_boot: $(FILES_PART_BOOT) state/sdcard_fmt +load_boot: FORCE $(FILES_PART_BOOT) state/sdcard_fmt mkdir -p mnt/boot $(AS_ROOT) mount $(SDCARD_PART_BOOT) mnt/boot $(AS_ROOT) cp $(FILES_PART_BOOT) mnt/boot $(AS_ROOT) sync $(AS_ROOT) umount mnt/boot -FILES_PART_ROOTFS += $(shell find rootfs) -FILES_PART_ROOTFS += busybox/rootfs -load_rootfs: $(FILES_PART_ROOTFS) state/sdcard_fmt +load_rootfs: FORCE $(FILES_PART_ROOTFS) state/sdcard_fmt mkdir -p mnt/rootfs $(AS_ROOT) mount $(SDCARD_PART_ROOTFS) mnt/rootfs $(AS_ROOT) util/mkrootfs mnt/rootfs $(AS_ROOT) sync $(AS_ROOT) umount mnt/rootfs -.PHONY: status -status: +status: FORCE @echo 'ENVIRONMENT' @state/gen | grep ':=' | sed -e 's/^\$$(eval / /' -e 's/)$$//' @echo 'TARGETS' @ls state | awk '$$0 == "gen" { next } { print }' | sed 's/^/ /' +__software_files: FORCE + @echo $(SOFTWARE_FILES) | tr ' ' '\n' -- cgit v1.2.3