summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2023-05-23 12:32:24 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2023-05-23 13:40:23 +0200
commita95700d1b11e5e6d9b5e8594b48a2ab2954669a6 (patch)
treebaa3aed0fdc86fda251e4dd47a5926e4cf66fd3b
Initial commit for wrapper makefiles for the Linux kernel
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--BF548-EZKIT.mak14
-rw-r--r--arm64.mak53
-rw-r--r--arm64_apq8016-sbc.mak26
-rw-r--r--arm64_hikey.mak17
-rw-r--r--arm64_virt.mak13
-rw-r--r--arm_davinci.mak11
-rw-r--r--arm_exynos.mak15
-rw-r--r--arm_keystone.mak11
-rw-r--r--arm_multi_v7.mak21
-rw-r--r--arm_omap1.mak10
-rw-r--r--arm_pxa.mak15
-rw-r--r--arm_s3c2410.mak16
-rw-r--r--arm_shmobile.mak25
-rw-r--r--arm_stm32mp1.mak29
-rw-r--r--arm_u8500.mak59
-rw-r--r--arm_vexpress.mak11
-rw-r--r--common.mak267
-rw-r--r--frv.mak14
-rw-r--r--i386.mak14
-rw-r--r--mips.mak17
-rw-r--r--mn10300.mak15
-rw-r--r--powerpc.mak17
-rw-r--r--tile.mak15
-rw-r--r--x86.mak21
24 files changed, 726 insertions, 0 deletions
diff --git a/BF548-EZKIT.mak b/BF548-EZKIT.mak
new file mode 100644
index 0000000..13e73bc
--- /dev/null
+++ b/BF548-EZKIT.mak
@@ -0,0 +1,14 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := BF548-EZKIT
+
+#Below needed since default is ARM
+arch := blackfin
+CROSS_COMPILE := bfin-uclinux-
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: build-uimage FORCE
+ @echo "complete."
diff --git a/arm64.mak b/arm64.mak
new file mode 100644
index 0000000..c02cc7c
--- /dev/null
+++ b/arm64.mak
@@ -0,0 +1,53 @@
+#The below should be set by a SoC specific makefile
+#rootfs := $(HOME)/devel/images/initramfs-arm64.cpio
+#soc := hisilicon
+#board := hi6220-hikey
+
+#ARM64 config
+defconfig :=
+
+#Below needed since default is ARM
+arch := arm64
+#Distributed by Linaro
+#CROSS_COMPILE := aarch64-linux-gnu-
+#Distributed by ARM
+CROSS_COMPILE := aarch64-none-linux-gnu-
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config-arm64-noramfs: config-base config-earlydebug FORCE
+ yes "" | make $(make_options) oldconfig
+
+config-arm64-ramfs: config-common config-earlydebug FORCE
+ yes "" | make $(make_options) oldconfig
+
+build-arm64: build-image-dt FORCE
+ @echo "complete."
+
+build-arm64-lk: build-lk-image-dt FORCE
+ @echo "complete."
+
+# For UEFI build these needs to be set by SoC specific makefile
+#boot_fat_dir := $(HOME)/builds/hikey/bin-uefi/boot-fat
+#boot_fat_img := $(HOME)/builds/hikey/bin-uefi/boot-fat.uefi.img
+
+install-arm64-uefi-img-all: FORCE
+ sudo mount -o loop,rw,sync $(boot_fat_img) $(boot_fat_dir)
+ sudo cp $(output_dir)/$(board).dtb $(boot_fat_dir)/.
+ sudo cp $(output_dir)/Image $(boot_fat_dir)/.
+ sudo cp $(rootfs) $(boot_fat_dir)/initrd.img
+ sync
+ sudo umount $(boot_fat_dir)
+
+install-arm64-uefi-img: FORCE
+ sudo mount -o loop,rw,sync $(boot_fat_img) $(boot_fat_dir)
+ sudo cp $(output_dir)/$(board).dtb $(boot_fat_dir)/.
+ sudo cp $(output_dir)/Image $(boot_fat_dir)/.
+ sync
+ sudo umount $(boot_fat_dir)
+
+build-arm64-uefi-all: build-arm64 install-arm64-uefi-img-all FORCE
+ @echo "complete."
+
+build-arm64-uefi: build-arm64 install-arm64-uefi-img FORCE
+ @echo "complete."
diff --git a/arm64_apq8016-sbc.mak b/arm64_apq8016-sbc.mak
new file mode 100644
index 0000000..d9aff0a
--- /dev/null
+++ b/arm64_apq8016-sbc.mak
@@ -0,0 +1,26 @@
+#To create LK bootimage
+export PATH := $(HOME)/devel/boards_src/410c/skales:$(PATH)
+
+soc := qcom
+board := apq8016-sbc
+
+# Config needed for LK bootimage
+cmdline := "init=init console=ttyMSM0,115200n8"
+rootfs := $(HOME)/devel/images/initramfs-arm64.cpio
+rootfs_null := $(HOME)/devel/images/null-initramfs
+base_addr := 0x80000000
+# APQ8064 or APQ8016 based boards (IFC6410, DB410c, DB600c, ...)
+pagesize := 2048
+# APQ8096 based boards (DB820c, ...)
+#pagesize := 4096
+
+include $(HOME)/devel/src/linux-makefiles/arm64.mak
+
+config-qcom-features: FORCE
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable POWER_RESET_QCOM_PON \
+ --enable INPUT_PM8941_PWRKEY
+
+config: config-arm64-ramfs config-qcom-features FORCE
+
+build: build-arm64-lk FORCE
diff --git a/arm64_hikey.mak b/arm64_hikey.mak
new file mode 100644
index 0000000..2103df1
--- /dev/null
+++ b/arm64_hikey.mak
@@ -0,0 +1,17 @@
+rootfs := $(HOME)/devel/images/initramfs-arm64.cpio
+soc := hisilicon
+board := hi6220-hikey
+# For UEFI builds
+#boot_fat_dir := $(HOME)/builds/hikey/bin-uefi/boot-fat
+#boot_fat_img := $(HOME)/builds/hikey/bin-uefi/boot-fat.uefi.img
+
+include $(HOME)/devel/src/linux-makefiles/arm64.mak
+
+config-uefi: config-arm64-noramfs FORCE
+
+config: config-arm64-ramfs FORCE
+
+build-uefi: build-arm64-uefi-all FORCE
+
+build: build-arm64 FORCE
+
diff --git a/arm64_virt.mak b/arm64_virt.mak
new file mode 100644
index 0000000..33dd37e
--- /dev/null
+++ b/arm64_virt.mak
@@ -0,0 +1,13 @@
+rootfs := $(HOME)/devel/images/initramfs-arm64.cpio
+soc := arm
+#board := foundation-v8.dts
+#board := foundation-v8-psci.dts
+board := foundation-v8-gicv3
+#board := foundation-v8-gicv3-psci.dts
+
+include $(HOME)/devel/src/linux-makefiles/arm64.mak
+
+config: config-arm64-noramfs FORCE
+
+build: build-arm64 FORCE
+
diff --git a/arm_davinci.mak b/arm_davinci.mak
new file mode 100644
index 0000000..d24dd2f
--- /dev/null
+++ b/arm_davinci.mak
@@ -0,0 +1,11 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := davinci_all
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: have-crosscompiler FORCE
+ $(MAKE) $(make_options) vmlinux
+ @echo "complete."
diff --git a/arm_exynos.mak b/arm_exynos.mak
new file mode 100644
index 0000000..723d4a6
--- /dev/null
+++ b/arm_exynos.mak
@@ -0,0 +1,15 @@
+#rootfs := $(HOME)/devel/images/initramfs-exynos5250.cpio
+rootfs := $(HOME)/devel/images/initramfs-arm.cpio
+board := exynos5250-arndale
+#board := exynos5420-arndale-octa
+#board := exynos5420-smdk5420
+defconfig := exynos
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: build-zimage-dt FORCE
+ @echo "complete."
+
diff --git a/arm_keystone.mak b/arm_keystone.mak
new file mode 100644
index 0000000..7fcd0cc
--- /dev/null
+++ b/arm_keystone.mak
@@ -0,0 +1,11 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := keystone
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: have-crosscompiler FORCE
+ $(MAKE) $(make_options) vmlinux
+ @echo "complete."
diff --git a/arm_multi_v7.mak b/arm_multi_v7.mak
new file mode 100644
index 0000000..c86d88f
--- /dev/null
+++ b/arm_multi_v7.mak
@@ -0,0 +1,21 @@
+#rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+rootfs := $(HOME)/devel/images/initramfs-arm.cpio
+#board := ste-hrefv60plus-tvk
+#board := stm32mp157c-dk2
+board := vexpress-v2p-ca9
+#board := vexpress-v2p-ca15_a7
+defconfig := multi_v7
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+config-arm-noramfs: config-base config-earlydebug FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: build-zimage-dt FORCE
+ @echo "complete."
+
+build-arm-nodtb: build-zimage-dt-nodtb FORCE
+ @echo "complete."
diff --git a/arm_omap1.mak b/arm_omap1.mak
new file mode 100644
index 0000000..a362dc0
--- /dev/null
+++ b/arm_omap1.mak
@@ -0,0 +1,10 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := omap1
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: build-plat FORCE
+ @echo "complete."
diff --git a/arm_pxa.mak b/arm_pxa.mak
new file mode 100644
index 0000000..ad91dac
--- /dev/null
+++ b/arm_pxa.mak
@@ -0,0 +1,15 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := pxa
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config-mmc: FORCE
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable MMC \
+ --enable MMC_PXA
+
+config: config-common config-mmc FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: build-zimage FORCE
+ @echo "complete."
diff --git a/arm_s3c2410.mak b/arm_s3c2410.mak
new file mode 100644
index 0000000..f521e4d
--- /dev/null
+++ b/arm_s3c2410.mak
@@ -0,0 +1,16 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := s3c2410
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable DMADEVICES \
+ --enable S3C24XX_DMAC \
+ --enable MMC_S3C
+ yes "" | make $(make_options) oldconfig
+
+build: have-crosscompiler FORCE
+ $(MAKE) $(make_options) vmlinux
+ @echo "complete."
+
diff --git a/arm_shmobile.mak b/arm_shmobile.mak
new file mode 100644
index 0000000..d6ce383
--- /dev/null
+++ b/arm_shmobile.mak
@@ -0,0 +1,25 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+board := r8a7791-koelsch
+defconfig := marzen
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config-shmobile: FORCE
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable ARCH_SH7372 \
+ --enable ARCH_SH73A0 \
+ --enable ARCH_R8A73A4 \
+ --enable ARCH_R8A7740 \
+ --enable ARCH_R8A7778 \
+ --enable ARCH_R8A7779 \
+ --enable ARCH_R8A7790 \
+ --enable ARCH_R8A7791 \
+ --enable ARCH_EMEV2 \
+ --enable ARCH_R7S72100
+
+config: config-common config-shmobile FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: build-zimage-dt FORCE
+ @echo "complete."
+
diff --git a/arm_stm32mp1.mak b/arm_stm32mp1.mak
new file mode 100644
index 0000000..aaa51c0
--- /dev/null
+++ b/arm_stm32mp1.mak
@@ -0,0 +1,29 @@
+#rootfs := $(HOME)/devel/images/initramfs-arm.cpio
+board := stm32mp157c-dk2
+defconfig := multi_v7
+# uImage build
+load_addr := 0xC0008000
+entry_addr := 0xC0008000
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+# For early printk
+config-stm32-earlydebug: FORCE
+ @echo "enable early debug"
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable DEBUG_LL \
+ --enable EARLY_PRINTK \
+
+config-stm32-fragments: FORCE
+ $(MAKE) $(make_options) fragment-01-multiv7_cleanup.config
+ $(MAKE) $(make_options) fragment-02-multiv7_addons.config
+
+# noramfs
+config: config-base config-stm32-earlydebug config-stm32-fragments FORCE
+ yes "" | make $(make_options) oldconfig
+
+config-ramfs: config-common FORCE
+
+build: build-uimage-dt-nodtb FORCE
+
+build-concat-dtb: build-uimage-dt FORCE
diff --git a/arm_u8500.mak b/arm_u8500.mak
new file mode 100644
index 0000000..ed73e0e
--- /dev/null
+++ b/arm_u8500.mak
@@ -0,0 +1,59 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+#board := ste-snowball
+board := ste-hrefv60plus-tvk
+defconfig := u8500
+# For uImage
+load_addr := 0x00008000
+entry_add := 0x00008000
+
+#For U8500 Android vendor tree build (needs also old gcc)
+#defconfig := ux500_ux540
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+# For early printk
+config-ux500-earlydebug: FORCE
+ @echo "enable ux500 early debug"
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable DEBUG_LL \
+ --enable EARLY_PRINTK \
+ --set-str CMDLINE "root=/dev/ram0 console=ttyAMA2,115200n8 earlyprintk" \
+ --set-str UX500_DEBUG_UART 2
+
+config-ux500-features: FORCE
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable HSI \
+ --enable HSI_CHAR
+
+config-ux500: config-ux500-features config-ux500-earlydebug FORCE
+
+config: config-common config-partition config-ux500 FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: build-zimage-dt FORCE
+ @echo "complete."
+
+modules: build-modules FORCE
+ @echo "complete."
+
+build-test: build-uimage-dt FORCE
+ @echo "complete."
+
+#For U8500 Android vendor tree builds
+# export path for mkbootimg, probably need older version?
+#export PATH := $(HOME)/devel/boards_src/410c/skales:$(PATH)
+# We have a common rule "build-lk-image-dt"
+
+build-vendor-lk-img: FORCE
+ @echo "Copy zImage to $(output_dir)/zImage"
+ @cp -f $(build_dir)/arch/$(arch)/boot/zImage $(output_dir)/zImage
+ mkbootimg \
+ --kernel $(output_dir)/zImage \
+ --ramdisk $(rootfs) \
+ --ramdisk_offset 0x02000000 \
+ --output $(output_dir)/zImage.img \
+ --base 0 ; \
+
+build-vendor: have-mkbootimg build-zimage build-vendor-lk-img FORCE
+ @echo "complete."
+
diff --git a/arm_vexpress.mak b/arm_vexpress.mak
new file mode 100644
index 0000000..13618b1
--- /dev/null
+++ b/arm_vexpress.mak
@@ -0,0 +1,11 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := vexpress
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: have-crosscompiler FORCE
+ $(MAKE) $(make_options) vmlinux
+ @echo "complete."
diff --git a/common.mak b/common.mak
new file mode 100644
index 0000000..d8620da
--- /dev/null
+++ b/common.mak
@@ -0,0 +1,267 @@
+arch ?= arm
+CROSS_COMPILE ?= arm-none-linux-gnueabihf-
+strip := $(CROSS_COMPILE)strip
+objcopy := $(CROSS_COMPILE)objcopy
+rootfsbase := $(shell basename $(rootfs))
+build_dir ?= $(CURDIR)/build-$(arch)
+install_dir := $(build_dir)/install
+config_file := $(build_dir)/.config
+dtb := $(build_dir)/arch/$(arch)/boot/dts/$(soc)/$(board).dtb
+output_dir ?= $(HOME)/builds/kernel/$(arch)_$(defoncfig)_$(board)
+
+makejobs := $(shell grep '^processor' /proc/cpuinfo | sort -u | wc -l)
+makethreads := $(shell dc -e "$(makejobs) 1 + p")
+#kcflags_options := "-Werror=unused-variable -Wmissing-prototypes"
+kcflags_options := "-Werror=unused-variable -Wshift-count-overflow"
+make_options := -f Makefile \
+ -j$(makethreads) -l$(makejobs) \
+ ARCH=$(arch) \
+ CROSS_COMPILE=$(CROSS_COMPILE) \
+ KBUILD_OUTPUT=$(build_dir) \
+ KCFLAGS=$(kcflags_options)
+
+.PHONY: help
+help:
+ @echo "**** Common Makefile ****"
+
+.PHONY: have-rootfs
+have-rootfs:
+ @if [ ! -f $(rootfs) ] ; then \
+ echo "ERROR: no rootfs at $(rootfs)" ; \
+ echo "This is needed to boot the system." ; \
+ echo "ABORTING." ; \
+ exit 1 ; \
+ else \
+ echo "Rootfs available at $(rootfs)" ; \
+ fi
+ @if [ ! -r $(rootfs) ] ; then \
+ echo "ERROR: rootfs at $(rootfs) not readable" ; \
+ echo "ABORTING." ; \
+ exit 1 ; \
+ fi
+
+.PHONY: have-rootfs-null
+have-rootfs-null:
+ @if [ ! -f $(rootfs_null) ] ; then \
+ echo "ERROR: no rootfs_null at $(rootfs_null)" ; \
+ echo "This is needed to build the image." ; \
+ echo "ABORTING." ; \
+ exit 1 ; \
+ fi
+
+.PHONY: have-crosscompiler
+have-crosscompiler:
+ @echo -n "Check that $(CROSS_COMPILE)gcc is available..."
+ @which $(CROSS_COMPILE)gcc > /dev/null ; \
+ if [ ! $$? -eq 0 ] ; then \
+ echo "ERROR: cross-compiler $(CROSS_COMPILE)gcc not in PATH=$$PATH!" ; \
+ echo "ABORTING." ; \
+ exit 1 ; \
+ else \
+ echo "OK" ;\
+ fi
+
+.PHONY: have-dtbtool
+have-dtbtool:
+ @echo -n "Check that "dtbTool" is available..."
+ @which dtbTool > /dev/null ; \
+ if [ ! $$? -eq 0 ] ; then \
+ echo "ERROR: dtbTool not in PATH=$$PATH!" ; \
+ echo "ABORTING." ; \
+ exit 1 ; \
+ else \
+ echo "OK" ;\
+ fi
+
+.PHONY: have-mkimage
+have-mkimage:
+ @which mkimage > /dev/null ; \
+ if [ ! $$? -eq 0 ] ; then \
+ echo "mkimage not in PATH=$$PATH" ; \
+ echo "This tool creates the uImage and comes from the uboot tools" ; \
+ echo "On Ubuntu/Debian sudo apt-get install uboot-mkimage" ; \
+ echo "SKIPPING uImage GENERATION" ; \
+ exit 1 ; \
+ fi
+
+.PHONY: have-mkbootimg
+have-mkbootimg:
+ @echo -n "Check that "mkbootimg" is available..."
+ @which mkbootimg > /dev/null ; \
+ if [ ! $$? -eq 0 ] ; then \
+ echo "ERROR: mkbootimg not in PATH=$$PATH!" ; \
+ echo "ABORTING." ; \
+ exit 1 ; \
+ else \
+ echo "OK" ;\
+ fi
+
+config-base: FORCE
+ @mkdir -p $(build_dir)
+ @mkdir -p $(output_dir)
+ @if [ -n "$(defconfig)" ] ; then \
+ $(MAKE) $(make_options) $(defconfig)_defconfig ; \
+ else \
+ $(MAKE) $(make_options) defconfig ; \
+ fi
+
+config-initramfs: have-rootfs FORCE
+ @cp $(rootfs) $(build_dir)/$(rootfsbase)
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable BLK_DEV_INITRD \
+ --enable RD_GZIP \
+ --set-str INITRAMFS_SOURCE $(rootfsbase) \
+ --enable INITRAMFS_COMPRESSION_GZIP
+
+config-multiplatform: FORCE
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable ARCH_MULTIPLATFORM
+
+config-partition: FORCE
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable PARTITION_ADVANCED
+
+config-earlydebug: FORCE
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable DEBUG_LL \
+ --enable EARLY_PRINTK \
+
+#This uses the above config rules
+config-common: config-base config-initramfs config-multiplatform FORCE
+ yes "" | make $(make_options) oldconfig
+
+config-allmod: FORCE
+ make $(make_options) allmodconfig
+
+menuconfig: FORCE
+ $(MAKE) $(make_options) menuconfig
+
+config-old: FORCE
+ no "" | make $(make_options) oldconfig
+
+saveconfig: FORCE
+ yes "" | make $(make_options) oldconfig
+ $(MAKE) $(make_options) savedefconfig
+
+# Tag on KBUILD_VERBOSE=1 to get verbose build output
+build-zimage: have-crosscompiler FORCE
+ $(MAKE) $(make_options) zImage
+
+# Used by x86
+build-bzimage: have-crosscompiler FORCE
+ $(MAKE) $(make_options) bzImage
+
+# Used by blackfin and mips
+build-uimage: have-crosscompiler FORCE
+ $(MAKE) $(make_options) uImage
+
+# Used by frv and arm64
+build-image: have-crosscompiler FORCE
+ $(MAKE) $(make_options) Image
+
+# For legacy builds
+build-zu-image: have-crosscompiler build-zimage have-mkimage FORCE
+ $(MAKE) $(make_options) uImage
+
+# Old buildrule for kernels using platform data only. (ux500 < 3.13)
+build-plat: build-zimage FORCE
+ @echo "Copy zImage to $(output_dir)/zImage"
+ @cp -f $(build_dir)/arch/$(arch)/boot/zImage $(output_dir)/zImage
+ @if [ -f $(build_dir)/arch/$(arch)/boot/uImage ] ; then \
+ echo "Copy uImage to $(output_dir)/uImage" ;\
+ cp -f $(build_dir)/arch/$(arch)/boot/uImage $(output_dir)/uImage ;\
+ fi
+
+build-dtbs: FORCE
+ $(MAKE) $(make_options) dtbs
+
+build-zimage-dt: build-zimage build-dtbs FORCE
+ @if [ ! -r $(dtb) ] ; then \
+ echo "NO DTB in $(dtb)!" ; \
+ exit 1 ; \
+ fi
+ @echo "Copy zImage to $(output_dir)/zImage"
+ @cp -f $(build_dir)/arch/$(arch)/boot/zImage $(output_dir)/zImage
+ @echo "Catenate DTB onto zImage $(output_dir)/zImage"
+ cat $(dtb) >> $(output_dir)/zImage ; \
+
+build-zimage-dt-nodtb: build-zimage build-dtbs FORCE
+ @if [ ! -r $(dtb) ] ; then \
+ echo "NO DTB in $(dtb)!" ; \
+ exit 1 ; \
+ fi
+ @echo "Copy zImage to $(output_dir)/zImage"
+ @cp -f $(build_dir)/arch/$(arch)/boot/zImage $(output_dir)/zImage
+ @echo "Copy DTB to $(output_dir)/$(board).dtb"
+ @cp -f $(dtb) $(output_dir)/$(board).dtb
+
+build-uimage-zimage: have-mkimage FORCE
+ mkimage \
+ -A $(arch) \
+ -O linux \
+ -T kernel \
+ -C none \
+ -a $(load_addr) \
+ -e $(entry_addr) \
+ -n "Device Tree kernel" \
+ -d $(output_dir)/zImage \
+ $(output_dir)/uImage ;
+ @echo "INFO: Boot uImage like this:"
+ @echo "INFO: mmc rescan 1 ; fat load mmc 1 0x0 /uImage ; bootm 0x0"
+
+build-uimage-dt: build-zimage-dt build-uimage-zimage FORCE
+
+build-uimage-dt-nodtb: build-zimage-dt-nodtb build-uimage-zimage FORCE
+
+build-image-dt: build-image build-dtbs FORCE
+ @echo "Copy Image to $(output_dir)/Image..."
+ @cp -f $(build_dir)/arch/$(arch)/boot/Image $(output_dir)/Image
+ @if [ ! -r $(dtb) ] ; then \
+ echo "NO DTB in $(dtb)!" ; \
+ exit 1 ; \
+ fi
+ @echo "Copy DTB to $(output_dir)/$(board).dtb"
+ @cp -f $(dtb) $(output_dir)/$(board).dtb
+
+build-lk-image-dt: have-rootfs-null have-dtbtool have-mkbootimg build-image-dt FORCE
+ dtbTool \
+ -o $(output_dir)/$(board).dtb.img \
+ $(output_dir) \
+ -s $(pagesize) ; \
+ mkbootimg \
+ --kernel $(output_dir)/Image \
+ --ramdisk $(rootfs_null) \
+ --output $(output_dir)/Image.img \
+ --dt $(output_dir)/$(board).dtb.img \
+ --pagesize $(pagesize) \
+ --base $(base_addr) \
+ --cmdline $(cmdline) ; \
+
+build-allmod: have-crosscompiler FORCE
+ $(MAKE) $(make_options) vmlinux modules
+ @echo "complete."
+
+# sudo apt install pkg-config (need to find libyaml)
+# sudo apt install libyaml-dev (or others)
+# To build one file:
+# DT_SCHEMA_FILES=Documentation/devicetree/bindings/arm/psci.yaml make -f ...
+dt_binding_check: FORCE
+ $(MAKE) $(make_options) dt_binding_check
+
+dtbs_check: FORCE
+ $(MAKE) $(make_options) dtbs_check
+
+tags: FORCE
+ $(MAKE) $(make_options) TAGS
+
+clean:
+ $(MAKE) -f Makefile clean distclean
+ rm -rf $(build_dir)
+
+build-modules: have-crosscompiler FORCE
+ $(MAKE) $(make_options) modules
+
+# Rules without commands or prerequisites that do not match a file name
+# are considered to always change when make runs. This means that any rule
+# that depends on FORCE will always be remade also.
+FORCE:
diff --git a/frv.mak b/frv.mak
new file mode 100644
index 0000000..7d15a12
--- /dev/null
+++ b/frv.mak
@@ -0,0 +1,14 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := ""
+
+#Below needed since default is ARM
+arch := frv
+CROSS_COMPILE := frv-linux-
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: build-image FORCE
+ @echo "complete."
diff --git a/i386.mak b/i386.mak
new file mode 100644
index 0000000..90dfb96
--- /dev/null
+++ b/i386.mak
@@ -0,0 +1,14 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := ""
+
+#Below needed since default is ARM
+arch := i386
+CROSS_COMPILE := ""
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: build-bzimage FORCE
+ @echo "complete."
diff --git a/mips.mak b/mips.mak
new file mode 100644
index 0000000..80c964c
--- /dev/null
+++ b/mips.mak
@@ -0,0 +1,17 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := qi_lb60
+#defconfig := bcm63xx
+#defconfig := db1xxx
+
+#Below needed since default is ARM
+arch := mips
+CROSS_COMPILE := mips-linux-
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: have-crosscompiler FORCE
+ $(MAKE) $(make_options) vmlinux
+ @echo "complete."
diff --git a/mn10300.mak b/mn10300.mak
new file mode 100644
index 0000000..462a51d
--- /dev/null
+++ b/mn10300.mak
@@ -0,0 +1,15 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := asb2303
+
+#Below needed since default is ARM
+arch := mn10300
+CROSS_COMPILE := am33_2.0-linux-
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: have-crosscompiler FORCE
+ $(MAKE) $(make_options) vmlinux
+ @echo "complete."
diff --git a/powerpc.mak b/powerpc.mak
new file mode 100644
index 0000000..05c453a
--- /dev/null
+++ b/powerpc.mak
@@ -0,0 +1,17 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := wii
+
+#Below needed since default is ARM
+arch := powerpc
+CROSS_COMPILE := powerpc-linux-gnu-
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable MMC_SDHCI_PLTFM \
+ --enable MMC_SDHCI_OF_HLWD
+ yes "" | make $(make_options) oldconfig
+
+build: build-zimage FORCE
+ @echo "complete."
diff --git a/tile.mak b/tile.mak
new file mode 100644
index 0000000..43292f6
--- /dev/null
+++ b/tile.mak
@@ -0,0 +1,15 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := tilegx
+
+#Below needed since default is ARM
+arch := tile
+CROSS_COMPILE := tilegx-linux-
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config: config-common FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: have-crosscompiler FORCE
+ $(MAKE) $(make_options) vmlinux
+ @echo "complete."
diff --git a/x86.mak b/x86.mak
new file mode 100644
index 0000000..0ebe13f
--- /dev/null
+++ b/x86.mak
@@ -0,0 +1,21 @@
+rootfs := $(HOME)/devel/images/initramfs-u8500.cpio
+defconfig := x86_64
+
+#Below needed since default is ARM
+arch := x86
+CROSS_COMPILE := ""
+
+include $(HOME)/devel/src/linux-makefiles/common.mak
+
+config-mmc: config-common FORCE
+ $(CURDIR)/scripts/config --file $(config_file) \
+ --enable MMC \
+ --enable MMC_SDHCI \
+ --enable MMC_SDHCI_ACPI \
+ --enable MMC_WBSD
+
+config: config-common config-mmc FORCE
+ yes "" | make $(make_options) oldconfig
+
+build: build-bzimage FORCE
+ @echo "complete."