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
lede-17.01
Florian Fainelli 2007-08-03 07:28:43 +00:00
parent 39f63f1d04
commit 0250efa1ea
7 changed files with 81 additions and 24 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,2 @@
# CONFIG_MTD_RDC3210_ALLOW_JFFS2 is not set
CONFIG_MTD_RDC3210_SIZE=0x200000

View File

@ -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))
{

View File

@ -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))

View File

@ -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))