diff options
author | Chris Blake <chrisrblake93@gmail.com> | 2017-10-20 12:36:25 -0500 |
---|---|---|
committer | Mathias Kresin <dev@kresin.me> | 2017-10-25 09:21:54 +0200 |
commit | ec269290db46d491ae61adb64b19b3f171b8e2a3 (patch) | |
tree | 91602b2a24759dd57794878f1afb0f7769dbda92 /target/linux/mpc85xx/image | |
parent | dcf62cb24efb2fd69eca921085c3f4306e76e8a2 (diff) | |
download | upstream-ec269290db46d491ae61adb64b19b3f171b8e2a3.tar.gz upstream-ec269290db46d491ae61adb64b19b3f171b8e2a3.tar.bz2 upstream-ec269290db46d491ae61adb64b19b3f171b8e2a3.zip |
mpc85xx: use new build code style
The following moves the mpc85xx target (generic & P1020) to the new
build code style.
Compile & Flash tested on an Aerohive HiveAP-330.
Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
Signed-off-by: Mathias Kresin <dev@kresin.me>
Diffstat (limited to 'target/linux/mpc85xx/image')
-rw-r--r-- | target/linux/mpc85xx/image/Makefile | 136 |
1 files changed, 53 insertions, 83 deletions
diff --git a/target/linux/mpc85xx/image/Makefile b/target/linux/mpc85xx/image/Makefile index 4738dcf122..f7de3bc5ce 100644 --- a/target/linux/mpc85xx/image/Makefile +++ b/target/linux/mpc85xx/image/Makefile @@ -1,107 +1,77 @@ # -# Copyright (C) 2010 OpenWrt.org -# # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -define imgname -$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1))) -endef - -define sysupname -$(call imgname,$(1),$(2))-sysupgrade.bin -endef +DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT -define factoryname -$(call imgname,$(1),$(2))-factory.bin +define Device/Default + PROFILES := Default + DEVICE_DTS := $(1) + KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts) + KERNEL_ENTRY := 0x00000000 + KERNEL_LOADADDR := 0x00000000 + KERNEL := kernel-bin endef -zImage:=$(BIN_DIR)/$(IMG_PREFIX)-zImage - -DTS_TARGETS = hiveap-330 fsl/p1010rdb-pa tl-wdr4900-v1 fsl/p1020rdb - -define Build/empty-initramfs - -mkdir $(KDIR_TMP)/empty-initramfs; \ - cd $(KDIR_TMP)/empty-initramfs; \ - find . | cpio -o -H newc | gzip -9n > $(KDIR_TMP)/empty-initramfs.gpio.gz - - -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) -O linux -T ramdisk \ - -C gzip -n "empty initramfs" \ - -d $(KDIR_TMP)/empty-initramfs.gpio.gz \ - $(KDIR_TMP)/$(IMG_PREFIX)-empty-initramfs.image +define Build/append-uImage-fakeramdisk-hdr + rm -f $@.fakeramdisk + $(STAGING_DIR_HOST)/bin/mkimage \ + -A $(LINUX_KARCH) -O linux -T ramdisk -C none \ + -n 'fakeramdisk' \ + -s \ + $@.fakeramdisk + cat $@.fakeramdisk >> $@ endef -define Image/BuildKernel - cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage - $(foreach dts,$(DTS_TARGETS), - $(LINUX_DIR)/scripts/dtc/dtc -I dts -O dtb $(DTS_DIR)/$(dts).dts > $(BIN_DIR)/$(IMG_PREFIX)-$(notdir $(dts)).fdt - ) +define Build/tplink-v1-image + $(STAGING_DIR_HOST)/bin/mktplinkfw \ + -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -F $(TPLINK_FLASHLAYOUT) \ + -N "$(VERSION_DIST)" -V $(REVISION) \ + -k $(IMAGE_KERNEL) \ + -r $(IMAGE_ROOTFS) \ + -j \ + $(1) \ + -o $@ endef -define Image/BuildKernel/Initramfs - cp $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-initramfs-zImage ifeq ($(SUBTARGET),generic) - cp $(KDIR)/cuImage.tl-wdr4900-v1-initramfs $(BIN_DIR)/$(IMG_PREFIX)-tl-wdr4900-v1-initramfs.uImage -endif -ifeq ($(SUBTARGET),p1020) - cp $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-hiveap-330-initramfs.zImage -endif -endef -define Image/Build/Aerohive - $(call Build/empty-initramfs) -ifeq ($(2),hiveap-330) - ( \ - dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2).fdt bs=256k conv=sync; \ - dd if=$(KDIR_TMP)/$(IMG_PREFIX)-empty-initramfs.image bs=256k conv=sync; \ - dd if=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=40704k conv=sync; \ - dd if=$(KDIR)/zImage conv=sync; \ - ) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-sysupgrade.img -endif +define Device/tl-wdr4900-v1 + DEVICE_TITLE := TP-Link TL-WDR4900 + DEVICE_PACKAGES := kmod-ath9k wpad-mini + TPLINK_HWID := 0x49000001 + TPLINK_HWREV := 1 + TPLINK_FLASHLAYOUT := 16Mppc + KERNEL_NAME := cuImage.tl-wdr4900-v1 + IMAGES := fdt.bin factory.bin sysupgrade.bin + IMAGE/fdt.bin := append-dtb + IMAGE/factory.bin := tplink-v1-image + IMAGE/sysupgrade.bin := tplink-v1-image -s endef +TARGET_DEVICES += tl-wdr4900-v1 -define Image/Build/TPLINK - -$(STAGING_DIR_HOST)/bin/mktplinkfw \ - -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) \ - -k $(KDIR)/$(3) \ - -r $(KDIR)/root.$(1) \ - -o $(call factoryname,$(1),$(2)) - -$(STAGING_DIR_HOST)/bin/mktplinkfw \ - -H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) -s \ - -k $(KDIR)/$(3) \ - -r $(KDIR)/root.$(1) \ - -o $(call sysupname,$(1),$(2)) -endef - -define Image/Build/Profile/hiveap-330 - $(call Image/Build/Aerohive,$(1),hiveap-330) -endef - -define Image/Build/Profile/TLWDR4900 - $(call Image/Build/TPLINK,$(1),tl-wdr4900-v1,cuImage.tl-wdr4900-v1,0x49000001,1,16Mppc) -endef - -define Image/Build/Profile/Default - $(call Image/Build/Profile/TLWDR4900,$(1)) -endef +endif -define Image/Build/ext2 - cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-ext2.img -endef +ifeq ($(SUBTARGET),p1020) -define Image/Build/squashfs - $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) - cp $(KDIR)/root.squashfs $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs +define Device/hiveap-330 + DEVICE_TITLE := Aerohive HiveAP-330 + DEVICE_PACKAGES := kmod-ath9k wpad-mini kmod-tpm-i2c-atmel + BLOCKSIZE := 128k + KERNEL_NAME := zImage + KERNEL_SIZE := 8m + IMAGES := fdt.bin sysupgrade.bin + IMAGE/fdt.bin := append-dtb + IMAGE/sysupgrade.bin := append-dtb | pad-to 256k | check-size 256k | \ + append-uImage-fakeramdisk-hdr | pad-to 256k | check-size 512k | \ + append-rootfs | pad-rootfs $$(BLOCKSIZE) | pad-to 41216k | check-size 41216k | \ + append-kernel endef +TARGET_DEVICES += hiveap-330 -PROFILE ?= Default - -define Image/Build - $(call Image/Build/$(1),$(1)) - $(call Image/Build/Profile/$(PROFILE),$(1)) -endef +endif $(eval $(call BuildImage)) |