From d8781887b7e03486ba4574846e93a390ada5fd35 Mon Sep 17 00:00:00 2001
From: Benjamin Larsson <benjamin@southpole.se>
Date: Tue, 2 Apr 2013 10:44:19 +0200
Subject: [PATCH] Fix brcm_ref Makefiles

---
 brcm63xx_ref_nand/Makefile       | 23 +++++++++++++++++++
 brcm63xx_ref_nand/image/Makefile | 39 ++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 brcm63xx_ref_nand/Makefile
 create mode 100644 brcm63xx_ref_nand/image/Makefile

diff --git a/brcm63xx_ref_nand/Makefile b/brcm63xx_ref_nand/Makefile
new file mode 100644
index 000000000..43dd75772
--- /dev/null
+++ b/brcm63xx_ref_nand/Makefile
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2006-2009 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+ARCH:=mips
+BOARD:=brcm63xx_ref_nand
+BOARDNAME:=Broadcom BCM63xx_ref_nand
+FEATURES:=
+LINUX_VERSION:=3.3.8
+MAINTAINER:=Benjamin Larsson <benjamin.larsson@inteno.se>
+
+include $(INCLUDE_DIR)/target.mk
+
+define Target/Description
+	Build firmware images for Broadcom based xDSL/routers
+	based on the Broadcom 4.14 SDK
+endef
+
+$(eval $(call BuildTarget))
diff --git a/brcm63xx_ref_nand/image/Makefile b/brcm63xx_ref_nand/image/Makefile
new file mode 100644
index 000000000..71274f857
--- /dev/null
+++ b/brcm63xx_ref_nand/image/Makefile
@@ -0,0 +1,39 @@
+# 
+# Copyright (C) 2006-2011 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
+
+KERNEL_ENTRY:= $(shell readelf -h $(KDIR)/vmlinux.bcm.elf | grep Entry | awk '{print $$4}')
+
+define Image/Build/REF
+	# Generate the tagged image
+	$(STAGING_DIR_HOST)/bin/imagetag_nand -i $(KDIR)/root.$(1) -f $(KDIR)/root.$(1) \
+		-o $(BIN_DIR)/IOPSYS-$(4).w \
+		-b $(2) \
+                -c $(3) \
+		-q NANDFS128
+endef
+
+
+define Image/Prepare
+	$(STAGING_DIR_HOST)/bin/lzma e -d22 -lp2 -lc1 $(KDIR)/vmlinux.bcm $(KDIR)/vmlinux.lzma
+	$(STAGING_DIR_HOST)/bin/imagetag_nand -K -i $(KDIR)/vmlinux.lzma -o $(KDIR)/vmlinux.lz -e $(KERNEL_ENTRY)
+
+	dd if=/dev/zero of=$(TMP_DIR)/file128k.tmp bs=1k count=128
+
+	echo -e "/cferam.000" > $(KDIR)/nocomprlist
+	echo -e "/vmlinux.lz" >> $(KDIR)/nocomprlist
+	touch $(TARGET_DIR)/cferam.000
+endef
+
+define Image/Build
+	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
+	# Various routers
+	$(call Image/Build/REF,$(1),963268,63268,VG50)
+endef
+
+$(eval $(call BuildImage))
-- 
GitLab