From 60ecd5fe04ebeaefedad4d06a756bc46bc772638 Mon Sep 17 00:00:00 2001
From: Florian Fainelli <florian@openwrt.org>
Date: Mon, 15 Oct 2012 18:54:34 +0000
Subject: [PATCH] merge the RDC R-321x target as a subtarget of x86

SVN-Revision: 33779
---
 target/linux/rdc/image/Makefile               | 47 -------------------
 target/linux/rdc/modules.mk                   | 22 ---------
 target/linux/x86/Makefile                     |  3 +-
 target/linux/x86/image/Config.in              |  2 +-
 target/linux/x86/image/Makefile               | 32 +++++++++++++
 .../{rdc => x86}/image/mkimg_bifferboard.py   |  0
 .../linux/{rdc => x86}/image/mkimg_sitecom.pl |  0
 target/linux/x86/modules.mk                   | 16 +++++++
 .../patches-3.3/006-yenta_mistery.patch       |  0
 .../009-rdc321x_select_embedded.patch         |  0
 .../patches-3.3/010-rdc_cpu_ident.patch       |  0
 .../patches-3.3/011-tune_lzma_options.patch   |  0
 .../patches-3.3/012-export_erase_write.patch  |  0
 .../patches-3.3/100-rdc_boards.patch          |  0
 .../120-panic_on_unrecovered_nmi.patch        |  0
 .../patches-3.3/150-pit-tick-rate.patch       |  0
 .../patches-3.3/160-kexec-fix.patch           |  0
 .../rdc/base-files/etc/config/network         |  0
 .../{ => x86}/rdc/base-files/etc/diag.sh      |  0
 .../lib/preinit/05_set_ether_mac_rdc          |  0
 .../rdc/base-files/lib/upgrade/platform.sh    |  0
 target/linux/{ => x86}/rdc/config-3.3         |  0
 target/linux/{ => x86}/rdc/profiles/ar525w.mk |  0
 .../{ => x86}/rdc/profiles/bifferboard.mk     |  0
 target/linux/{ => x86}/rdc/profiles/r8610.mk  |  0
 .../linux/{ => x86}/rdc/profiles/sitecom.mk   |  0
 .../linux/{rdc/Makefile => x86/rdc/target.mk} | 20 +-------
 27 files changed, 53 insertions(+), 89 deletions(-)
 delete mode 100644 target/linux/rdc/image/Makefile
 delete mode 100644 target/linux/rdc/modules.mk
 rename target/linux/{rdc => x86}/image/mkimg_bifferboard.py (100%)
 rename target/linux/{rdc => x86}/image/mkimg_sitecom.pl (100%)
 rename target/linux/{rdc => x86}/patches-3.3/006-yenta_mistery.patch (100%)
 rename target/linux/{rdc => x86}/patches-3.3/009-rdc321x_select_embedded.patch (100%)
 rename target/linux/{rdc => x86}/patches-3.3/010-rdc_cpu_ident.patch (100%)
 rename target/linux/{rdc => x86}/patches-3.3/011-tune_lzma_options.patch (100%)
 rename target/linux/{rdc => x86}/patches-3.3/012-export_erase_write.patch (100%)
 rename target/linux/{rdc => x86}/patches-3.3/100-rdc_boards.patch (100%)
 rename target/linux/{rdc => x86}/patches-3.3/120-panic_on_unrecovered_nmi.patch (100%)
 rename target/linux/{rdc => x86}/patches-3.3/150-pit-tick-rate.patch (100%)
 rename target/linux/{rdc => x86}/patches-3.3/160-kexec-fix.patch (100%)
 rename target/linux/{ => x86}/rdc/base-files/etc/config/network (100%)
 rename target/linux/{ => x86}/rdc/base-files/etc/diag.sh (100%)
 rename target/linux/{ => x86}/rdc/base-files/lib/preinit/05_set_ether_mac_rdc (100%)
 rename target/linux/{ => x86}/rdc/base-files/lib/upgrade/platform.sh (100%)
 rename target/linux/{ => x86}/rdc/config-3.3 (100%)
 rename target/linux/{ => x86}/rdc/profiles/ar525w.mk (100%)
 rename target/linux/{ => x86}/rdc/profiles/bifferboard.mk (100%)
 rename target/linux/{ => x86}/rdc/profiles/r8610.mk (100%)
 rename target/linux/{ => x86}/rdc/profiles/sitecom.mk (100%)
 rename target/linux/{rdc/Makefile => x86/rdc/target.mk} (57%)

diff --git a/target/linux/rdc/image/Makefile b/target/linux/rdc/image/Makefile
deleted file mode 100644
index 7086b998cd..0000000000
--- a/target/linux/rdc/image/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Copyright (C) 2006-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 Image/Prepare
-	$(CP) $(LINUX_DIR)/arch/x86/boot/bzImage $(KDIR)/bzImage
-endef
-
-define Image/Build/ar525w
-	cp $(KDIR)/bzImage $(KDIR)/bzImage.tmp
-	$(SCRIPT_DIR)/pad_image $(1) $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) 32
-	$(STAGING_DIR_HOST)/bin/airlink -b 1 $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2).img
-	$(STAGING_DIR_HOST)/bin/airlink -e -b 1 $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2)-web.img
-endef
-
-define Image/Build/sitecom
-	cp $(KDIR)/bzImage $(KDIR)/bzImage.tmp
-	#32k config data + 20 bytes header + 2 bytes checksum after kernel image
-	$(SCRIPT_DIR)/pad_image $(1) $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) 32790
-	$(TOPDIR)/target/linux/rdc/image/mkimg_sitecom.pl $(KDIR)/bzImage.tmp > $(KDIR)/tmp.img
-	cat $(KDIR)/root.$(1) >> $(KDIR)/tmp.img
-	cp $(KDIR)/tmp.img $(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2).img
-	rm $(KDIR)/tmp.img $(KDIR)/bzImage.tmp
-endef
-
-define Image/Build/bifferboard
-	$(TOPDIR)/target/linux/rdc/image/mkimg_bifferboard.py $(KDIR)/bzImage $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-$(2).img
-endef
-
-define Image/Build/Initramfs
-	$(CP) $(KDIR)/bzImage $(BIN_DIR)/$(IMG_PREFIX)-ramfs.bzImage
-endef
-
-define Image/Build
-	$(CP) $(KDIR)/bzImage $(BIN_DIR)/$(IMG_PREFIX).bzImage
-	$(call Image/Build/$(PROFILE),$(1),$(PROFILE),$(patsubst jffs2-%k,%,$(1)))
-ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
-	$(call Image/Build/Initramfs)
-endif
-endef
-
-$(eval $(call BuildImage))
diff --git a/target/linux/rdc/modules.mk b/target/linux/rdc/modules.mk
deleted file mode 100644
index ce7cbdf6e3..0000000000
--- a/target/linux/rdc/modules.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-define KernelPackage/rdc321x-wdt
-  SUBMENU:=$(OTHER_MENU)
-  TITLE:=RDC321x watchdog
-  DEPENDS:=@TARGET_rdc
-  KCONFIG:=CONFIG_RDC321X_WDT
-  FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/rdc321x_wdt.ko
-  AUTOLOAD:=$(call AutoLoad,50,rdc321x_wdt)
-endef
-
-define KernelPackage/rdc321x-wdt/description
-  RDC-321x watchdog driver
-endef
-
-$(eval $(call KernelPackage,rdc321x-wdt))
-
diff --git a/target/linux/x86/Makefile b/target/linux/x86/Makefile
index 422e828d4d..a64fbc38c9 100644
--- a/target/linux/x86/Makefile
+++ b/target/linux/x86/Makefile
@@ -10,7 +10,8 @@ ARCH:=i386
 BOARD:=x86
 BOARDNAME:=x86
 FEATURES:=squashfs jffs2 ext4 vdi vmdk pcmcia targz
-SUBTARGETS=generic olpc xen_domu ep80579 net5501 kvm_guest geos alix2 thincan
+SUBTARGETS=generic olpc xen_domu ep80579 net5501 kvm_guest geos alix2 thincan \
+	   rdc
 
 LINUX_VERSION:=3.3.8
 
diff --git a/target/linux/x86/image/Config.in b/target/linux/x86/image/Config.in
index 653aa61eff..9ced34c93e 100644
--- a/target/linux/x86/image/Config.in
+++ b/target/linux/x86/image/Config.in
@@ -15,7 +15,7 @@ config X86_ETHERBOOT_BOOTOPTS
 
 config X86_GRUB_IMAGES
 	bool "Build GRUB images (Linux x86 or x86_64 host only)"
-	depends TARGET_x86 && !TARGET_x86_olpc
+	depends TARGET_x86 && !(TARGET_x86_olpc || TARGET_x86_rdc)
 	depends TARGET_ROOTFS_EXT4FS || TARGET_ROOTFS_ISO || TARGET_ROOTFS_JFFS2 || TARGET_ROOTFS_SQUASHFS
 	select PACKAGE_grub2
 	default y
diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index 3552748e60..399ce3c7d3 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -206,12 +206,40 @@ define Image/BuildKernel
   endif
 endef
 
+define Image/Build/Profile/ar525w
+	cp $(KDIR)/bzImage $(KDIR)/bzImage.tmp
+	$(SCRIPT_DIR)/pad_image $(1) $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) 32
+	$(STAGING_DIR_HOST)/bin/airlink -b 1 $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) \
+		$(BIN_DIR)/$(IMG_PREFIX)-$(1)-ar525w.img
+	$(STAGING_DIR_HOST)/bin/airlink -e -b 1 $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) \
+		$(BIN_DIR)/$(IMG_PREFIX)-$(1)-ar525w-web.img
+endef
+
+define Image/Build/Profile/sitecom
+	cp $(KDIR)/bzImage $(KDIR)/bzImage.tmp
+	#32k config data + 20 bytes header + 2 bytes checksum after kernel image
+	$(SCRIPT_DIR)/pad_image $(1) $(KDIR)/bzImage.tmp $(KDIR)/root.$(1) 32790
+	$(TOPDIR)/target/linux/rdc/image/mkimg_sitecom.pl $(KDIR)/bzImage.tmp > $(KDIR)/tmp.img
+	cat $(KDIR)/root.$(1) >> $(KDIR)/tmp.img
+	cp $(KDIR)/tmp.img $(BIN_DIR)/$(IMG_PREFIX)-$(1)-sitecom.img
+	rm $(KDIR)/tmp.img $(KDIR)/bzImage.tmp
+endef
+
+define Image/Build/Profile/bifferboard
+	$(TOPDIR)/target/linux/rdc/image/mkimg_bifferboard.py $(KDIR)/bzImage $(KDIR)/root.$(1) \
+		$(BIN_DIR)/$(IMG_PREFIX)-$(1)-bifferboard.img
+endef
+
 define Image/Prepare
 	$(CP) $(LINUX_DIR)/arch/x86/boot/bzImage $(KDIR)/bzImage
 	$(call Image/Prepare/bootscript)
 	$(call Image/Prepare/grub2)
 endef
 
+define Image/Build/Initramfs
+	$(CP) $(KDIR)/bzImage $(BIN_DIR)/$(IMG_PREFIX)-ramfs.bzImage
+endef
+
 define Image/Build
 	$(call Image/Build/$(1))
 	$(call Image/Build/bootscript,$(1))
@@ -225,6 +253,10 @@ define Image/Build
   endif
 	$(CP) $(KDIR)/bzImage $(BIN_DIR)/$(IMG_PREFIX)-vmlinuz
 	$(call Image/Build/gzip/$(1))
+	$(call Image/Build/Profile/$(PROFILE),$(1))
+ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
+	$(call Image/Build/Initramfs)
+endif
 endef
 
 $(eval $(call BuildImage))
diff --git a/target/linux/rdc/image/mkimg_bifferboard.py b/target/linux/x86/image/mkimg_bifferboard.py
similarity index 100%
rename from target/linux/rdc/image/mkimg_bifferboard.py
rename to target/linux/x86/image/mkimg_bifferboard.py
diff --git a/target/linux/rdc/image/mkimg_sitecom.pl b/target/linux/x86/image/mkimg_sitecom.pl
similarity index 100%
rename from target/linux/rdc/image/mkimg_sitecom.pl
rename to target/linux/x86/image/mkimg_sitecom.pl
diff --git a/target/linux/x86/modules.mk b/target/linux/x86/modules.mk
index 70a64ffdb4..f0d436c1e9 100644
--- a/target/linux/x86/modules.mk
+++ b/target/linux/x86/modules.mk
@@ -312,3 +312,19 @@ define KernelPackage/leds-net48xx/description
 endef
 
 $(eval $(call KernelPackage,leds-net48xx))
+
+define KernelPackage/rdc321x-wdt
+  SUBMENU:=$(OTHER_MENU)
+  TITLE:=RDC321x watchdog
+  DEPENDS:=@TARGET_x86_rdc
+  KCONFIG:=CONFIG_RDC321X_WDT
+  FILES:=$(LINUX_DIR)/drivers/$(WATCHDOG_DIR)/rdc321x_wdt.ko
+  AUTOLOAD:=$(call AutoLoad,50,rdc321x_wdt)
+endef
+
+define KernelPackage/rdc321x-wdt/description
+  RDC-321x watchdog driver
+endef
+
+$(eval $(call KernelPackage,rdc321x-wdt))
+
diff --git a/target/linux/rdc/patches-3.3/006-yenta_mistery.patch b/target/linux/x86/patches-3.3/006-yenta_mistery.patch
similarity index 100%
rename from target/linux/rdc/patches-3.3/006-yenta_mistery.patch
rename to target/linux/x86/patches-3.3/006-yenta_mistery.patch
diff --git a/target/linux/rdc/patches-3.3/009-rdc321x_select_embedded.patch b/target/linux/x86/patches-3.3/009-rdc321x_select_embedded.patch
similarity index 100%
rename from target/linux/rdc/patches-3.3/009-rdc321x_select_embedded.patch
rename to target/linux/x86/patches-3.3/009-rdc321x_select_embedded.patch
diff --git a/target/linux/rdc/patches-3.3/010-rdc_cpu_ident.patch b/target/linux/x86/patches-3.3/010-rdc_cpu_ident.patch
similarity index 100%
rename from target/linux/rdc/patches-3.3/010-rdc_cpu_ident.patch
rename to target/linux/x86/patches-3.3/010-rdc_cpu_ident.patch
diff --git a/target/linux/rdc/patches-3.3/011-tune_lzma_options.patch b/target/linux/x86/patches-3.3/011-tune_lzma_options.patch
similarity index 100%
rename from target/linux/rdc/patches-3.3/011-tune_lzma_options.patch
rename to target/linux/x86/patches-3.3/011-tune_lzma_options.patch
diff --git a/target/linux/rdc/patches-3.3/012-export_erase_write.patch b/target/linux/x86/patches-3.3/012-export_erase_write.patch
similarity index 100%
rename from target/linux/rdc/patches-3.3/012-export_erase_write.patch
rename to target/linux/x86/patches-3.3/012-export_erase_write.patch
diff --git a/target/linux/rdc/patches-3.3/100-rdc_boards.patch b/target/linux/x86/patches-3.3/100-rdc_boards.patch
similarity index 100%
rename from target/linux/rdc/patches-3.3/100-rdc_boards.patch
rename to target/linux/x86/patches-3.3/100-rdc_boards.patch
diff --git a/target/linux/rdc/patches-3.3/120-panic_on_unrecovered_nmi.patch b/target/linux/x86/patches-3.3/120-panic_on_unrecovered_nmi.patch
similarity index 100%
rename from target/linux/rdc/patches-3.3/120-panic_on_unrecovered_nmi.patch
rename to target/linux/x86/patches-3.3/120-panic_on_unrecovered_nmi.patch
diff --git a/target/linux/rdc/patches-3.3/150-pit-tick-rate.patch b/target/linux/x86/patches-3.3/150-pit-tick-rate.patch
similarity index 100%
rename from target/linux/rdc/patches-3.3/150-pit-tick-rate.patch
rename to target/linux/x86/patches-3.3/150-pit-tick-rate.patch
diff --git a/target/linux/rdc/patches-3.3/160-kexec-fix.patch b/target/linux/x86/patches-3.3/160-kexec-fix.patch
similarity index 100%
rename from target/linux/rdc/patches-3.3/160-kexec-fix.patch
rename to target/linux/x86/patches-3.3/160-kexec-fix.patch
diff --git a/target/linux/rdc/base-files/etc/config/network b/target/linux/x86/rdc/base-files/etc/config/network
similarity index 100%
rename from target/linux/rdc/base-files/etc/config/network
rename to target/linux/x86/rdc/base-files/etc/config/network
diff --git a/target/linux/rdc/base-files/etc/diag.sh b/target/linux/x86/rdc/base-files/etc/diag.sh
similarity index 100%
rename from target/linux/rdc/base-files/etc/diag.sh
rename to target/linux/x86/rdc/base-files/etc/diag.sh
diff --git a/target/linux/rdc/base-files/lib/preinit/05_set_ether_mac_rdc b/target/linux/x86/rdc/base-files/lib/preinit/05_set_ether_mac_rdc
similarity index 100%
rename from target/linux/rdc/base-files/lib/preinit/05_set_ether_mac_rdc
rename to target/linux/x86/rdc/base-files/lib/preinit/05_set_ether_mac_rdc
diff --git a/target/linux/rdc/base-files/lib/upgrade/platform.sh b/target/linux/x86/rdc/base-files/lib/upgrade/platform.sh
similarity index 100%
rename from target/linux/rdc/base-files/lib/upgrade/platform.sh
rename to target/linux/x86/rdc/base-files/lib/upgrade/platform.sh
diff --git a/target/linux/rdc/config-3.3 b/target/linux/x86/rdc/config-3.3
similarity index 100%
rename from target/linux/rdc/config-3.3
rename to target/linux/x86/rdc/config-3.3
diff --git a/target/linux/rdc/profiles/ar525w.mk b/target/linux/x86/rdc/profiles/ar525w.mk
similarity index 100%
rename from target/linux/rdc/profiles/ar525w.mk
rename to target/linux/x86/rdc/profiles/ar525w.mk
diff --git a/target/linux/rdc/profiles/bifferboard.mk b/target/linux/x86/rdc/profiles/bifferboard.mk
similarity index 100%
rename from target/linux/rdc/profiles/bifferboard.mk
rename to target/linux/x86/rdc/profiles/bifferboard.mk
diff --git a/target/linux/rdc/profiles/r8610.mk b/target/linux/x86/rdc/profiles/r8610.mk
similarity index 100%
rename from target/linux/rdc/profiles/r8610.mk
rename to target/linux/x86/rdc/profiles/r8610.mk
diff --git a/target/linux/rdc/profiles/sitecom.mk b/target/linux/x86/rdc/profiles/sitecom.mk
similarity index 100%
rename from target/linux/rdc/profiles/sitecom.mk
rename to target/linux/x86/rdc/profiles/sitecom.mk
diff --git a/target/linux/rdc/Makefile b/target/linux/x86/rdc/target.mk
similarity index 57%
rename from target/linux/rdc/Makefile
rename to target/linux/x86/rdc/target.mk
index db97a33377..32b300466a 100644
--- a/target/linux/rdc/Makefile
+++ b/target/linux/x86/rdc/target.mk
@@ -1,22 +1,8 @@
-#
-# Copyright (C) 2006-2012 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-
-ARCH:=i386
-BOARD:=rdc
-BOARDNAME:=RDC 321x
-FEATURES:=squashfs jffs2 pci usb pcmcia
+BOARDNAME:=RDC R-321x
+FEATURES:=squashfs jffs2 pci usb gpio pcmcia
 CFLAGS:=-Os -pipe -march=i486 -mtune=i486 -fno-caller-saves
 MAINTAINER:=Florian Fainelli <florian@openwrt.org>
 
-LINUX_VERSION:=3.3.8
-
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += kmod-llc kmod-stp kmod-bridge kmod-8021q \
 		    wpad-mini kmod-libphy kmod-r6040 kmod-input-core \
 		    kmod-input-polldev kmod-input-gpio-buttons kmod-button-hotplug \
@@ -26,5 +12,3 @@ define Target/Description
         Build firmware images for RDC321x based routers
         (e.g. Airlink101 AR525W, Linksys WRT54GR, Sitecom WL-153)
 endef
-
-$(eval $(call BuildTarget))
-- 
2.30.2