summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2007-08-03 07:28:43 +0000
committerFlorian Fainelli <florian@openwrt.org>2007-08-03 07:28:43 +0000
commit0250efa1eaa2929f8ec35de6fd2ae0e29cf41450 (patch)
tree0bcbc4801bff647a77fde97f2d2436c80cf680c7
parent39f63f1d04ef782e1972702239ad4dd44c0132b1 (diff)
downloadmtk-20170518-0250efa1eaa2929f8ec35de6fd2ae0e29cf41450.zip
mtk-20170518-0250efa1eaa2929f8ec35de6fd2ae0e29cf41450.tar.gz
mtk-20170518-0250efa1eaa2929f8ec35de6fd2ae0e29cf41450.tar.bz2
Make jffs2 images work with rdc, add a sitecom wl-153 profile and kernel config, fix rt61 installation (thanks to Daniel Gimpelevich)
SVN-Revision: 8328
-rw-r--r--package/rt61/Makefile2
-rw-r--r--target/linux/rdc-2.6/Makefile2
-rw-r--r--target/linux/rdc-2.6/config/default12
-rw-r--r--target/linux/rdc-2.6/config/profile-wl1532
-rw-r--r--target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c58
-rw-r--r--target/linux/rdc-2.6/image/Makefile16
-rw-r--r--target/linux/rdc-2.6/profiles/WL-153.mk13
7 files changed, 81 insertions, 24 deletions
diff --git a/package/rt61/Makefile b/package/rt61/Makefile
index 6e7c600..228cd86 100644
--- a/package/rt61/Makefile
+++ b/package/rt61/Makefile
@@ -33,7 +33,7 @@ define KernelPackage/rt61
endef
define KernelPackage/rt61/install
- mkdir $(1)/lib/firmware
+ mkdir -p $(1)/lib/firmware
$(CP) -L $(PKG_BUILD_DIR)/Module/rt2*.bin $(1)/lib/firmware
endef
diff --git a/target/linux/rdc-2.6/Makefile b/target/linux/rdc-2.6/Makefile
index dd49781..bf096f2 100644
--- a/target/linux/rdc-2.6/Makefile
+++ b/target/linux/rdc-2.6/Makefile
@@ -24,8 +24,8 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
define Kernel/SetInitramfs
rm -f $(BUILD_DIR)/root/sbin/init
ln -s /etc/preinit $(BUILD_DIR)/root/sbin/init
- # $(CP) $(PLATFORM_DIR)/image/preinit.arch $(BUILD_DIR)/root/etc/
sed -i 's,exec /sbin/init,exec /bin/busybox init,g' $(BUILD_DIR)/root/etc/preinit
+ sed -i 's,/sbin/init,/bin/busybox init,g' $(BUILD_DIR)/root/init
endef
endif
diff --git a/target/linux/rdc-2.6/config/default b/target/linux/rdc-2.6/config/default
index c8298b5..c28d44b 100644
--- a/target/linux/rdc-2.6/config/default
+++ b/target/linux/rdc-2.6/config/default
@@ -11,7 +11,6 @@ CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_ARCH_POPULATES_NODE_MAP=y
# CONFIG_ARCH_SUPPORTS_MSI is not set
CONFIG_ATA=m
-# CONFIG_ATA_GENERIC is not set
# CONFIG_ATA_NONSTANDARD is not set
CONFIG_ATA_PIIX=m
# CONFIG_ATM_DRIVERS is not set
@@ -22,11 +21,8 @@ CONFIG_BITREVERSE=y
# CONFIG_BLK_DEV_HD is not set
# CONFIG_BLK_DEV_HD_IDE is not set
CONFIG_BLK_DEV_IDE=m
-# CONFIG_BLK_DEV_IDECD is not set
CONFIG_BLK_DEV_IDEDISK=m
# CONFIG_BLK_DEV_IDEDMA is not set
-# CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_BLK_DEV_IDEPCI is not set
CONFIG_CLOCKSOURCE_WATCHDOG=y
# CONFIG_COMPAT_VDSO is not set
# CONFIG_CPU5_WDT is not set
@@ -79,20 +75,16 @@ CONFIG_HZ_250=y
CONFIG_I2C=m
# CONFIG_I2C_ALGOBIT is not set
CONFIG_I2C_BOARDINFO=y
-# CONFIG_I2C_CHARDEV is not set
# CONFIG_I6300ESB_WDT is not set
# CONFIG_I8K is not set
# CONFIG_IB700_WDT is not set
# CONFIG_IBMASR is not set
# CONFIG_IBM_ASM is not set
CONFIG_IDE=m
-# CONFIG_IDEDISK_MULTI_MODE is not set
# CONFIG_IDEPCI_PCIBUS_ORDER is not set
# CONFIG_IDE_ARM is not set
# CONFIG_IDE_GENERIC is not set
-CONFIG_IDE_MAX_HWIFS=4
# CONFIG_IDE_PROC_FS is not set
-# CONFIG_IDE_TASK_IOCTL is not set
# CONFIG_IKCONFIG is not set
CONFIG_INITRAMFS_SOURCE=""
CONFIG_INPUT=m
@@ -110,7 +102,6 @@ CONFIG_KTIME_SCALAR=y
# CONFIG_KVM is not set
CONFIG_LBD=y
CONFIG_LEDS_RDC3211=m
-# CONFIG_LEDS_TRIGGER_IDE_DISK is not set
CONFIG_LSF=y
# CONFIG_M386 is not set
CONFIG_M486=y
@@ -223,7 +214,6 @@ CONFIG_PCI_GOANY=y
# CONFIG_PCI_GODIRECT is not set
# CONFIG_PCI_GOMMCONFIG is not set
CONFIG_PCMCIA=m
-# CONFIG_PDC_ADMA is not set
CONFIG_PHYSICAL_ALIGN=0x100000
CONFIG_PHYSICAL_START=0x100000
# CONFIG_PNPACPI is not set
@@ -233,7 +223,6 @@ CONFIG_R6040=m
# CONFIG_RELOCATABLE is not set
# CONFIG_RTC is not set
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-# CONFIG_SATA_AHCI is not set
# CONFIG_SBC8360_WDT is not set
# CONFIG_SBC_EPX_C3_WATCHDOG is not set
# CONFIG_SC1200_WDT is not set
@@ -267,7 +256,6 @@ CONFIG_USB_EHCI_HCD=m
CONFIG_USB_OHCI_HCD=m
CONFIG_USB_PWC=m
# CONFIG_USB_PWC_DEBUG is not set
-# CONFIG_USB_STORAGE_ISD200 is not set
# CONFIG_USB_UHCI_HCD is not set
CONFIG_V4L_USB_DRIVERS=y
# CONFIG_VGASTATE is not set
diff --git a/target/linux/rdc-2.6/config/profile-wl153 b/target/linux/rdc-2.6/config/profile-wl153
new file mode 100644
index 0000000..3ab59a8
--- /dev/null
+++ b/target/linux/rdc-2.6/config/profile-wl153
@@ -0,0 +1,2 @@
+# CONFIG_MTD_RDC3210_ALLOW_JFFS2 is not set
+CONFIG_MTD_RDC3210_SIZE=0x200000
diff --git a/target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c b/target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c
index 3bd6cf2..16ce471 100644
--- a/target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c
+++ b/target/linux/rdc-2.6/files/drivers/mtd/maps/rdc3210.c
@@ -29,6 +29,7 @@ struct map_info rdc3210_map =
/* Dante: This is the default static mapping, however this is nothing but a hint. (Say dynamic mapping) */
static struct mtd_partition rdc3210_parts[] =
{
+#if CONFIG_MTD_RDC3210_SIZE == 0x400000
{ name: "linux", offset: 0, size: 0x003C0000 }, /* 3840 KB = (Kernel + ROMFS) = (768 KB + 3072 KB) */
{ name: "romfs", offset: 0x000C0000, size: 0x00300000 }, /* 3072 KB */
{ name: "nvram", offset: 0x003C0000, size: 0x00010000 }, /* 64 KB */
@@ -36,6 +37,17 @@ static struct mtd_partition rdc3210_parts[] =
{ name: "factory", offset: 0x003D0000, size: 0x00010000 }, /* 64 KB */
#endif
{ name: "bootldr", offset: 0x003E0000, size: 0x00020000 }, /* 128 KB */
+#elif CONFIG_MTD_RDC3210_SIZE == 0x200000
+ { name: "linux", offset: 0x00010000, size: 0x001E0000 },
+ { name: "romfs", offset: 0x000D0000, size: 0x00120000 },
+ { name: "nvram", offset: 0x00000000, size: 0x00010000 }, /* 64 KB */
+#ifdef CONFIG_MTD_RDC3210_FACTORY_PRESENT
+#error Unsupported configuration!
+#endif
+ { name: "bootldr", offset: 0x001F0000, size: 0x00010000 },
+#else
+#error Unsupported configuration!
+#endif
};
static __u32 crctab[257] = {
@@ -197,19 +209,42 @@ static int __init init_rdc3210_map(void)
#include "imghdr.h"
+ typedef struct {
+ u8 magic[4];
+ u32 kernelsz, ramdisksz;
+ u8 magic2[4];
+ u32 sz2;
+ }sc_imghdr_t;
+
if (rdc3210_mtd)
{ // Dante
- gt_imghdr_t *hdr = (gt_imghdr_t *)(rdc3210_map.map_priv_1)
+ sc_imghdr_t *hdr2= (sc_imghdr_t *)(rdc3210_map.map_priv_1);
+ gt_imghdr_t *hdr = (gt_imghdr_t *)hdr2
#ifdef CONFIG_MTD_RDC3210_ALLOW_JFFS2
, *ptmp
#endif
;
- unsigned int tmp = hdr->kernelsz + sizeof(gt_imghdr_t), tmp2 = rdc3210_mtd->erasesize;
- unsigned int tmp3 = ((tmp / 32) + ((tmp % 32) ? 1 : 0)) * 32;
- unsigned int tmp4 = ((tmp / tmp2) + ((tmp % tmp2) ? 1 : 0)) * tmp2;
- int len;
+ int len, tmp, tmp2, tmp3, tmp4, hdr_type = 0;
- if(memcmp(hdr->magic, GTIMG_MAGIC, 4))
+ if(!memcmp(hdr->magic, GTIMG_MAGIC, 4))
+ {
+ hdr_type = 1;
+ tmp = hdr->kernelsz + sizeof(gt_imghdr_t);
+ tmp2 = rdc3210_mtd->erasesize;
+ tmp3 = ((tmp / 32) + ((tmp % 32) ? 1 : 0)) * 32;
+ tmp4 = ((tmp / tmp2) + ((tmp % tmp2) ? 1 : 0)) * tmp2;
+ }
+#ifndef CONFIG_MTD_RDC3210_ALLOW_JFFS2
+ else if (!memcmp(hdr2->magic, "CSYS", 4))
+ {
+ hdr_type = 2;
+ tmp = hdr2->ramdisksz + hdr2->kernelsz + sizeof(sc_imghdr_t);
+ tmp2 = rdc3210_mtd->erasesize;
+ tmp3 = ((tmp / 32) + ((tmp % 32) ? 1 : 0)) * 32;
+ tmp4 = ((tmp / tmp2) + ((tmp % tmp2) ? 1 : 0)) * tmp2;
+ }
+#endif
+ else
{
iounmap((void *)rdc3210_map.map_priv_1);
rdc3210_map.map_priv_1 = 0L;
@@ -253,6 +288,7 @@ static int __init init_rdc3210_map(void)
rdc3210_parts[3].offset = tmp - (tmp % tmp2);
rdc3210_parts[3].size = rdc3210_mtd->size - rdc3210_parts[3].offset;
#endif
+ if (hdr_type == 1) {
/* 3. Adjust NVRAM */
#ifdef CONFIG_MTD_RDC3210_ALLOW_JFFS2
if (*(__u32 *)(((unsigned char *)ptmp)+tmp3) == SQUASHFS_MAGIC)
@@ -273,13 +309,19 @@ static int __init init_rdc3210_map(void)
rdc3210_parts[2].offset = tmp - (tmp % tmp2);
}
rdc3210_parts[2].size = rdc3210_parts[3].offset - rdc3210_parts[2].offset;
+ }
+ else if (hdr_type == 2)
+ {
+ len = 0;
+ tmp4 = tmp3;
+ }
/* 4. Adjust Linux (Kernel + ROMFS) */
- rdc3210_parts[0].size = rdc3210_parts[len + 2].offset - rdc3210_parts[0].offset;
+ rdc3210_parts[0].size = rdc3210_parts[len + hdr_type + 1].offset - rdc3210_parts[0].offset;
/* 5. Adjust ROMFS */
rdc3210_parts[1].offset = rdc3210_parts[0].offset + tmp4;
- rdc3210_parts[1].size = rdc3210_parts[2].offset - rdc3210_parts[1].offset;
+ rdc3210_parts[1].size = rdc3210_parts[hdr_type + 1].offset - rdc3210_parts[1].offset;
#ifdef CONFIG_MTD_RDC3210_ALLOW_JFFS2
if (!(hdr->reserved || len))
{
diff --git a/target/linux/rdc-2.6/image/Makefile b/target/linux/rdc-2.6/image/Makefile
index 4fceb20..7f28507 100644
--- a/target/linux/rdc-2.6/image/Makefile
+++ b/target/linux/rdc-2.6/image/Makefile
@@ -21,7 +21,7 @@ define trxalign/squashfs
bs=1024
endef
-define Image/Build/Airlink
+define Image/Build/ar525w
touch $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img
mv $(KDIR)/root.$(1) $(KDIR)/root.tmp
dd of=$(KDIR)/root.$(1) if=$(KDIR)/root.tmp $(call trxalign/$(1)) conv=sync
@@ -29,9 +29,21 @@ define Image/Build/Airlink
$(STAGING_DIR)/bin/airlink -b 1 -j $(shell bash -c 'echo $$[$(3)]') $(KDIR)/bzImage $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img
endef
+define Image/Build/wl153
+ echo $(shell ls -l $(KDIR)/bzImage | sed -r 's/^[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+([^[:blank:]]+).+$$/\1/' | xargs printf '%.8x') > $(KDIR)/bzSize
+ gzip -9c $(KDIR)/root.$(1) > $(KDIR)/root.$(1).gz
+ echo $(shell ls -l $(KDIR)/root.$(1).gz | sed -r 's/^[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+[^[:blank:]]+[[:blank:]]+([^[:blank:]]+).+$$/\1/' | xargs printf '%.8x') > $(KDIR)/rdSize
+ echo -ne "\x$$$$(cut -c 7,8 < $(KDIR)/bzSize)\x$$$$(cut -c 5,6 < $(KDIR)/bzSize)\x$$$$(cut -c 3,4 < $(KDIR)/bzSize)\x$$$$(cut -c 1,2 < $(KDIR)/bzSize)" > $(KDIR)/bzSize.tmp
+ echo -n 'CSYS' > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img
+ cat $(KDIR)/bzSize.tmp >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img
+ echo -ne "\x$$$$(cut -c 7,8 < $(KDIR)/rdSize)\x$$$$(cut -c 5,6 < $(KDIR)/rdSize)\x$$$$(cut -c 3,4 < $(KDIR)/rdSize)\x$$$$(cut -c 1,2 < $(KDIR)/rdSize)WRRM" >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img
+ cat $(KDIR)/bzSize.tmp $(KDIR)/bzImage $(KDIR)/root.$(1).gz >> $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-$(2).img
+ rm -f $(KDIR)/bzSize.tmp $(KDIR)/bzSize $(KDIR)/rdSize
+endef
+
define Image/Build
$(CP) $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL).bzImage
- $(call Image/Build/Airlink,$(1),$(PROFILE),$(patsubst jffs2-%k,%,$(1)))
+ $(call Image/Build/$(PROFILE),$(1),$(PROFILE),$(patsubst jffs2-%k,%,$(1)))
endef
$(eval $(call BuildImage))
diff --git a/target/linux/rdc-2.6/profiles/WL-153.mk b/target/linux/rdc-2.6/profiles/WL-153.mk
new file mode 100644
index 0000000..8a94894
--- /dev/null
+++ b/target/linux/rdc-2.6/profiles/WL-153.mk
@@ -0,0 +1,13 @@
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/wl153
+ NAME:=Sitecom WL-153
+ PACKAGES:=kmod-rt61 kmod-r6040
+endef
+$(eval $(call Profile,wl153))
+