lantiq: use new build code for DGN3500

Signed-off-by: Mathias Kresin <dev@kresin.me>
This commit is contained in:
Mathias Kresin 2016-10-01 09:59:00 +02:00
parent 1f7a03a706
commit fa14124616

View File

@ -8,8 +8,6 @@
# boards missing since devicetree update
#EASY50712 ARV3527P
JFFS2_BLOCKSIZE = 64k 128k 256k
KERNEL_LOADADDR = 0x80002000
KERNEL_ENTRY = 0x80002000
@ -27,82 +25,10 @@ define Build/eva-image
( dd if=$@.new bs=64k conv=sync; cat ./eva.dummy.squashfs; ) > $@
endef
define CompressLzma
$(STAGING_DIR_HOST)/bin/lzma e $(1) $(2)
define Build/dgn3500-sercom-footer
$(STAGING_DIR_HOST)/bin/dgn3500sum $@ $(1) $(2)
endef
define PatchKernelLzma
cp $(KDIR)/vmlinux$(2) $(KDIR)/vmlinux$(2)-$(1)
$(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(1).dtb ../dts/$(1).dts
cat $(KDIR)/vmlinux$(2)-$(1) $(KDIR)/$(1).dtb > $(KDIR)/vmlinux$(2)-$(1).tmp
$(call CompressLzma,$(KDIR)/vmlinux$(2)-$(1).tmp,$(KDIR)/vmlinux$(2)-$(1).lzma)
endef
define MkImageLzma
mkimage -A mips -O linux -T kernel -a 0x80002000 -C lzma \
-e 0x80002000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
-d $(KDIR)/vmlinux$(2)-$(1).lzma $(KDIR)/uImage-$(1)$(2)
endef
define Image/Build/squashfs
cat $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
$(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image)
endef
DGN3500_SKERNEL=0x50000
DGN3500_SKERNEL_DECIMAL=327680
define Image/BuildDGN3500/squashfs
dd if=/dev/zero of=$(BIN_DIR)/$(IMG_PREFIX)-pad bs=$(DGN3500_SKERNEL_DECIMAL) count=1
cat $(BIN_DIR)/$(IMG_PREFIX)-pad $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img
rm -r $(BIN_DIR)/$(IMG_PREFIX)-pad
dd if=/dev/zero ibs=16M count=1 | tr "\000" "\377" > $(BIN_DIR)/$(IMG_PREFIX)-pwf
cp $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img
dgn3500sum $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img $(DGN3500_SKERNEL) NA
$(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img)
cp $(BIN_DIR)/$(IMG_PREFIX)-pwf $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-NA.img
dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-NA.img conv=notrunc
dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-sysupgrade-NA.image bs=$(DGN3500_SKERNEL_DECIMAL) skip=1
rm -r $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadNA.img
mv $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img
dgn3500sum $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img $(DGN3500_SKERNEL) WW
$(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img)
mv $(BIN_DIR)/$(IMG_PREFIX)-pwf $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-WW.img
dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-WW.img conv=notrunc
dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-sysupgrade-WW.image bs=$(DGN3500_SKERNEL_DECIMAL) skip=1
rm -r $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepadWW.img
endef
define Image/BuildDGN3500B/squashfs
dd if=/dev/zero of=$(BIN_DIR)/$(IMG_PREFIX)-pad bs=327680 count=1
cat $(BIN_DIR)/$(IMG_PREFIX)-pad $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img
rm -r $(BIN_DIR)/$(IMG_PREFIX)-pad
dd if=/dev/zero ibs=16M count=1 | tr "\000" "\377" > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory.img
dgn3500sum $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img $(DGN3500_SKERNEL) DE
$(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img)
dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory.img conv=notrunc
dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-sysupgrade.image bs=$(DGN3500_SKERNEL_DECIMAL) skip=1
rm -r $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-factory-prepad.img
dgn3500sum $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)-sysupgrade.image $(DGN3500_SKERNEL) DE
endef
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
define Image/BuildKernel/InitramfsTemplate
$(call PatchKernelLzma,$(1),-initramfs)
$(call MkImageLzma,$(1),-initramfs)
$(CP) $(KDIR)/uImage-$(1)-initramfs $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage-initramfs
endef
endif
define Image/BuildKernel/Template
$(call PatchKernelLzma,$(1))
$(call MkImageLzma,$(1))
$(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage
$(Image/BuildKernel/InitramfsTemplate)
endef
### Kernel scripts ###
define Build/mkbrncmdline
mkbrncmdline -i $@ -o $@.new BRN-BOOT
mv $@.new $@
@ -423,10 +349,27 @@ define Device/BTHOMEHUBV3A
endef
TARGET_DEVICES += BTHOMEHUBV3A
Image/BuildKernel/Profile/DGN3500=$(call Image/BuildKernel/Template,DGN3500)
Image/Build/Profile/DGN3500=$(call Image/BuildDGN3500/$(1),$(1),DGN3500)
define LegacyDevice/DGN3500
DGN3500_KERNEL_OFFSET_HEX=0x50000
DGN3500_KERNEL_OFFSET_DEC=327680
define Device/DGN3500
IMAGE_SIZE := 16000k
IMAGES := \
sysupgrade-NA.bin sysupgrade-WW.bin \
factory-NA.bin factory-WW.bin
IMAGE/sysupgrade-NA.bin := \
append-kernel | append-rootfs | dgn3500-sercom-footer 0x0 "NA" | \
pad-rootfs | check-size $$$$(IMAGE_SIZE)
IMAGE/sysupgrade-WW.bin := \
append-kernel | append-rootfs | dgn3500-sercom-footer 0x0 "WW" | \
pad-rootfs | check-size $$$$(IMAGE_SIZE)
IMAGE/factory-NA.bin := \
pad-extra $(DGN3500_KERNEL_OFFSET_DEC) | append-kernel | append-rootfs | \
dgn3500-sercom-footer $(DGN3500_KERNEL_OFFSET_HEX) "NA" | pad-rootfs | \
check-size 16320k | pad-to 16384k
IMAGE/factory-WW.bin := \
pad-extra $(DGN3500_KERNEL_OFFSET_DEC) | append-kernel | append-rootfs | \
dgn3500-sercom-footer $(DGN3500_KERNEL_OFFSET_HEX) "WW" | pad-rootfs | \
check-size 16320k | pad-to 16384k
DEVICE_TITLE := Netgear DGN3500
DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport \
kmod-ath9k wpad-mini \
@ -435,12 +378,18 @@ define LegacyDevice/DGN3500
ltq-adsl-app ppp-mod-pppoa \
kmod-ltq-deu-ar9 swconfig
endef
LEGACY_DEVICES += DGN3500
TARGET_DEVICES += DGN3500
Image/BuildKernel/Profile/DGN3500B=$(call Image/BuildKernel/Template,DGN3500B)
Image/Build/Profile/DGN3500B=$(call Image/BuildDGN3500B/$(1),$(1),DGN3500B)
define LegacyDevice/DGN3500B
define Device/DGN3500B
IMAGE_SIZE := 16000k
IMAGES += factory.bin
IMAGE/sysupgrade.bin := \
append-kernel | append-rootfs | dgn3500-sercom-footer 0x0 "DE" | \
pad-rootfs | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.bin := \
pad-extra $(DGN3500_KERNEL_OFFSET_DEC) | append-kernel | append-rootfs | \
dgn3500-sercom-footer $(DGN3500_KERNEL_OFFSET_HEX) "DE" | pad-rootfs | \
check-size 16320k | pad-to 16384k
DEVICE_TITLE := Netgear DGN3500B
DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport \
kmod-ath9k wpad-mini \
@ -449,7 +398,7 @@ define LegacyDevice/DGN3500B
ltq-adsl-app ppp-mod-pppoa \
kmod-ltq-deu-ar9 swconfig
endef
LEGACY_DEVICES += DGN3500B
TARGET_DEVICES += DGN3500B
define Device/WBMRA
IMAGE_SIZE := 31488k
@ -633,16 +582,4 @@ TARGET_DEVICES += VGV7519BRN
endif
define Image/Prepare/Profile
$(call Image/Prepare/Profile/$(1))
endef
define Image/BuildKernel/Profile
$(call Image/BuildKernel/Profile/$(1))
endef
define Image/Build/Profile
$(call Image/Build/Profile/$(1),$(2))
endef
$(eval $(call BuildImage))