diff options
author | James <> | 2015-11-04 11:49:21 +0000 |
---|---|---|
committer | James <> | 2015-11-04 11:49:21 +0000 |
commit | 716ca530e1c4515d8683c9d5be3d56b301758b66 (patch) | |
tree | 700eb5bcc1a462a5f21dcec15ce7c97ecfefa772 /target/linux/rb532 | |
download | trunk-47381-master.tar.gz trunk-47381-master.tar.bz2 trunk-47381-master.zip |
Diffstat (limited to 'target/linux/rb532')
-rw-r--r-- | target/linux/rb532/Makefile | 19 | ||||
-rw-r--r-- | target/linux/rb532/base-files.mk | 11 | ||||
-rw-r--r-- | target/linux/rb532/base-files/etc/config/network | 25 | ||||
-rw-r--r-- | target/linux/rb532/base-files/etc/diag.sh | 17 | ||||
-rwxr-xr-x | target/linux/rb532/base-files/sbin/cf2nand | 67 | ||||
-rwxr-xr-x | target/linux/rb532/base-files/sbin/wget2nand | 71 | ||||
-rw-r--r-- | target/linux/rb532/config-default | 146 | ||||
-rw-r--r-- | target/linux/rb532/image/Makefile | 80 | ||||
-rwxr-xr-x | target/linux/rb532/image/gen_image.sh | 18 | ||||
-rw-r--r-- | target/linux/rb532/modules.mk | 45 | ||||
-rw-r--r-- | target/linux/rb532/patches/001-cmdline_hack.patch | 20 | ||||
-rw-r--r-- | target/linux/rb532/patches/002-rb532_nand_fixup.patch | 47 | ||||
-rw-r--r-- | target/linux/rb532/patches/004-rb532_partition_info-rename-rootfs-to-rootfs_onboard.patch | 11 | ||||
-rw-r--r-- | target/linux/rb532/src/patch-cmdline.c | 79 |
14 files changed, 656 insertions, 0 deletions
diff --git a/target/linux/rb532/Makefile b/target/linux/rb532/Makefile new file mode 100644 index 0000000..e5c6ad7 --- /dev/null +++ b/target/linux/rb532/Makefile @@ -0,0 +1,19 @@ +# +# 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 + +ARCH:=mipsel +BOARD:=rb532 +BOARDNAME:=Mikrotik RouterBoard 532 +FEATURES:=pci targz + +KERNEL_PATCHVER:=3.18 + +include $(INCLUDE_DIR)/target.mk +DEFAULT_PACKAGES += wpad-mini kmod-ath5k kmod-input-rb532 + +$(eval $(call BuildTarget)) diff --git a/target/linux/rb532/base-files.mk b/target/linux/rb532/base-files.mk new file mode 100644 index 0000000..afd1220 --- /dev/null +++ b/target/linux/rb532/base-files.mk @@ -0,0 +1,11 @@ +define Build/Compile + $(call Build/Compile/Default) + $(TARGET_CC) -o $(PKG_BUILD_DIR)/patch-cmdline $(PLATFORM_DIR)/src/patch-cmdline.c +endef + +define Package/base-files/install-target + mkdir -p $(1)/sbin + $(CP) $(PKG_BUILD_DIR)/patch-cmdline $(1)/sbin +endef + + diff --git a/target/linux/rb532/base-files/etc/config/network b/target/linux/rb532/base-files/etc/config/network new file mode 100644 index 0000000..75a14a7 --- /dev/null +++ b/target/linux/rb532/base-files/etc/config/network @@ -0,0 +1,25 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface wan + option ifname eth0 + option proto dhcp + +config interface lan + option ifname eth2 + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + option ip6assign 60 + +config interface wan6 + option ifname eth0 + option proto dhcpv6 + +config globals globals + option ula_prefix auto diff --git a/target/linux/rb532/base-files/etc/diag.sh b/target/linux/rb532/base-files/etc/diag.sh new file mode 100644 index 0000000..482b8e9 --- /dev/null +++ b/target/linux/rb532/base-files/etc/diag.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Copyright (C) 2007-2013 OpenWrt.org + +. /lib/functions/leds.sh + +status_led="rb500led:amber" + +set_state() { + case "$1" in + preinit) + status_led_on + ;; + done) + status_led_off + ;; + esac +} diff --git a/target/linux/rb532/base-files/sbin/cf2nand b/target/linux/rb532/base-files/sbin/cf2nand new file mode 100755 index 0000000..0bfc259 --- /dev/null +++ b/target/linux/rb532/base-files/sbin/cf2nand @@ -0,0 +1,67 @@ +#!/bin/sh +. /lib/functions.sh + +copy_kernel() { + local input="$1" + local output="$2" + local cmdline="$3" + size="$(echo -n "$cmdline" | wc -c)" + dd if="$input" bs=3M count=1 > "$output" + /sbin/patch-cmdline "$output" "$cmdline" +} + +fstype="$(mount | grep ' / ' | awk '$5 != "rootfs" {print $5}')" +case "$fstype" in + ext2|jffs2) echo "Copying from $fstype to yaffs2";; + *) echo "Invalid filesystem."; exit 1;; +esac + +[ -d /tmp/cf2nand ] && { + echo "/tmp/cf2nand already exists" + exit 1 +} + +mkdir /tmp/cf2nand +mkdir /tmp/cf2nand/rootfs +mount -t "$fstype" /dev/root /tmp/cf2nand/rootfs || { + echo "Mounting rootfs failed." + exit 1 +} + +boot="$(find_mtd_part 'Routerboard NAND boot')" +main="$(find_mtd_part 'rootfs')" +[ -z "$boot" -o -z "$main" ] && { + echo "Cannot find NAND Flash partitions" + exit 1 +} + +echo "Erasing filesystem..." +mtd erase Boot 2>/dev/null >/dev/null +mtd erase Main 2>/dev/null >/dev/null + +mkdir /tmp/cf2nand/p1 +mkdir /tmp/cf2nand/p2 +mount -t yaffs2 "$boot" /tmp/cf2nand/p1 +mount -t yaffs2 "$main" /tmp/cf2nand/p2 + +echo "Copying kernel..." +copy_kernel /dev/cfa1 /tmp/cf2nand/p1/kernel "root=/dev/mtdblock1 rootfstype=yaffs2 " 2>/dev/null >/dev/null +umount /tmp/cf2nand/p1 +rmdir /tmp/cf2nand/p1 + +echo "Copying filesystem..." +( cd /tmp/cf2nand/rootfs; tar c . ) | ( cd /tmp/cf2nand/p2; tar x ) +echo "chmod ugo+x /" > /tmp/cf2nand/p2/etc/uci-defaults/set_root_permission +sync +# Use kexec is present +[ -x /usr/bin/kexec ] && { + kexec -l /tmp/cf2nand/p1/kernel --command-line="$(cat /proc/cmdline) root=/dev/mtdblock1 rootfstype=yaffs2" + kexec -e +} +umount /tmp/cf2nand/p2 +rmdir /tmp/cf2nand/p2 + +umount /tmp/cf2nand/rootfs +rmdir /tmp/cf2nand/rootfs +rmdir /tmp/cf2nand + diff --git a/target/linux/rb532/base-files/sbin/wget2nand b/target/linux/rb532/base-files/sbin/wget2nand new file mode 100755 index 0000000..9a111fa --- /dev/null +++ b/target/linux/rb532/base-files/sbin/wget2nand @@ -0,0 +1,71 @@ +#!/bin/sh +# wget2nand +# This script can be used to download a TGZ file from your build system which +# contains the files to be installed on the NAND flash on your RB1xx card. +# The one parameter is the URL of the TGZ file to be downloaded. +# Licence GPL V2 +# Author david.goodenough@linkchoose.co.uk +# Based on cf2nand from RB532 support +. /lib/functions.sh + +[ -d /tmp/wget2nand ] && { + echo "/tmp/wget2nand already exists" + exit 1 +} + +# first get an address for br-lan using udhcpc +killall udhcpc +/sbin/udhcpc -i br-lan + +# need to find the wget server from the command line +url=$1 +[ -z "$url" ] && { + echo "No URL specified for image TGZ" + echo "Usage : $0 URL" + exit 1 +} + +boot="$(find_mtd_part 'Routerboard NAND Boot')" +main="$(find_mtd_part 'rootfs')" +[ -z "$boot" -o -z "$main" ] && { + echo "Cannot find NAND Flash partitions" + exit 1 +} + +echo "Erasing filesystem." +mtd erase Boot 2>/dev/null >/dev/null +mtd erase Main 2>/dev/null >/dev/null + +echo "Mounting $main as new root and $boot as boot partition" + +mkdir /tmp/wget2nand/ +mkdir /tmp/wget2nand-boot +mount -t yaffs2 "$main" /tmp/wget2nand/ +mount -t yaffs2 "$boot" /tmp/wget2nand-boot + +echo "Copying filesystem..." +( wget -O - $url/openwrt-rb532-rootfs.tgz) | ( cd /tmp/wget2nand/; tar xvz ) +wget -O /tmp/wget2nand-boot/kernel $url/openwrt-rb532-vmlinux + +# No need to patch the kernel, this was done during the build process +chmod +x /tmp/wget2nand-boot/kernel + +# make sure everything is written before we unmount the partitions +echo "chmod ugo+x /" > /tmp/wget2nand/etc/uci-defaults/set_root_permission +sync +ls /tmp/wget2nand-boot/ +ls /tmp/wget2nand/ +# use kexec if present +[ -x /usr/bin/kexec ] && { + kexec -l /tmp/wget2nand-boot/kernel --command-line="$(cat /proc/cmdline) root=$main rootfstype=yaffs2" + kexec -e +} + +# unmount the partitions and remove the directories into which they were mounted +umount /tmp/wget2nand-boot +umount /tmp/wget2nand +rmdir /tmp/wget2nand-boot +rmdir /tmp/wget2nand + +# all done +echo "Image written, you can now reboot. Remember to change the boot source to Boot from Nand" diff --git a/target/linux/rb532/config-default b/target/linux/rb532/config-default new file mode 100644 index 0000000..246c5d2 --- /dev/null +++ b/target/linux/rb532/config-default @@ -0,0 +1,146 @@ +CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y +CONFIG_ARCH_DISCARD_MEMBLOCK=y +CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y +CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_REQUIRE_GPIOLIB=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y +CONFIG_ATA=y +CONFIG_BLK_DEV_SD=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_CEVT_R4K=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CPU_GENERIC_DUMP_TLB=y +CONFIG_CPU_HAS_PREFETCH=y +CONFIG_CPU_HAS_SYNC=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_MIPS32=y +CONFIG_CPU_MIPS32_R1=y +CONFIG_CPU_MIPSR1=y +CONFIG_CPU_R4K_CACHE_TLB=y +CONFIG_CPU_R4K_FPU=y +CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y +CONFIG_CPU_SUPPORTS_HIGHMEM=y +CONFIG_CRC16=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_HASH=y +CONFIG_CRYPTO_HASH2=y +CONFIG_CSRC_R4K=y +CONFIG_DMA_NONCOHERENT=y +# CONFIG_ENABLE_WARN_DEPRECATED is not set +CONFIG_EXT4_FS=y +CONFIG_FS_MBCACHE=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_GENERIC_IO=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_DEVRES=y +CONFIG_GPIO_SYSFS=y +CONFIG_HARDWARE_WATCHPOINTS=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set +CONFIG_HAVE_ARCH_JUMP_LABEL=y +CONFIG_HAVE_ARCH_KGDB=y +# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set +CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_HAVE_DEBUG_KMEMLEAK=y +CONFIG_HAVE_DMA_API_DEBUG=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_GENERIC_DMA_COHERENT=y +CONFIG_HAVE_GENERIC_HARDIRQS=y +CONFIG_HAVE_IDE=y +CONFIG_HAVE_MEMBLOCK=y +CONFIG_HAVE_MEMBLOCK_NODE_MAP=y +CONFIG_HAVE_MOD_ARCH_SPECIFIC=y +CONFIG_HAVE_NET_DSA=y +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_PERF_EVENTS=y +# CONFIG_HIGH_RES_TIMERS is not set +CONFIG_HW_HAS_PCI=y +CONFIG_HW_RANDOM=y +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +CONFIG_HZ_PERIODIC=y +CONFIG_IMAGE_CMDLINE_HACK=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQ_CPU=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +CONFIG_JBD2=y +CONFIG_KEXEC=y +CONFIG_KORINA=y +CONFIG_LEDS_MIKROTIK_RB532=y +CONFIG_MIKROTIK_RB532=y +CONFIG_MIPS=y +# CONFIG_MIPS_HUGE_TLB_SUPPORT is not set +CONFIG_MIPS_L1_CACHE_SHIFT=4 +# CONFIG_MIPS_MACHINE is not set +CONFIG_MIPS_MT_DISABLED=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MTD_BLOCK2MTD=y +CONFIG_MTD_CFI_ADV_OPTIONS=y +# CONFIG_MTD_CFI_AMDSTD is not set +CONFIG_MTD_CFI_GEOMETRY=y +# CONFIG_MTD_CFI_INTELEXT is not set +# CONFIG_MTD_COMPLEX_MAPPINGS is not set +CONFIG_MTD_NAND=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_PLATFORM=y +CONFIG_MTD_PHYSMAP=y +# CONFIG_MTD_ROOTFS_ROOT_DEV is not set +CONFIG_MTD_ROOTFS_SPLIT=y +# CONFIG_MTD_SM_COMMON is not set +# CONFIG_MTD_SPLIT is not set +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_PATA_RB532=y +CONFIG_PCI=y +CONFIG_PCI_DISABLE_COMMON_QUIRKS=y +CONFIG_PCI_DOMAINS=y +CONFIG_PERF_USE_VMALLOC=y +# CONFIG_PREEMPT_RCU is not set +CONFIG_RC32434_WDT=y +# CONFIG_RCU_STALL_COMMON is not set +CONFIG_SCSI=y +# CONFIG_SCSI_LOWLEVEL is not set +# CONFIG_SCSI_MULTI_LUN is not set +# CONFIG_SCSI_PROC_FS is not set +# CONFIG_SWAP is not set +CONFIG_SWAP_IO_SPACE=y +CONFIG_SYS_HAS_CPU_MIPS32_R1=y +CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y +CONFIG_SYS_SUPPORTS_ARBIT_HZ=y +CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_UIDGID_CONVERTED=y +CONFIG_USB_ARCH_HAS_XHCI=y +CONFIG_VIA_RHINE=y +CONFIG_VIA_RHINE_MMIO=y +CONFIG_YAFFS_9BYTE_TAGS=y +# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set +CONFIG_YAFFS_AUTO_YAFFS2=y +# CONFIG_YAFFS_DISABLE_BACKGROUND is not set +# CONFIG_YAFFS_DISABLE_BLOCK_REFRESHING is not set +# CONFIG_YAFFS_DISABLE_TAGS_ECC is not set +# CONFIG_YAFFS_EMPTY_LOST_AND_FOUND is not set +CONFIG_YAFFS_FS=y +CONFIG_YAFFS_XATTR=y +CONFIG_YAFFS_YAFFS1=y +CONFIG_YAFFS_YAFFS2=y +CONFIG_ZONE_DMA_FLAG=0 diff --git a/target/linux/rb532/image/Makefile b/target/linux/rb532/image/Makefile new file mode 100644 index 0000000..284b3d4 --- /dev/null +++ b/target/linux/rb532/image/Makefile @@ -0,0 +1,80 @@ +# +# 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 + +LOADADDR = 0x81000000 # RAM start + 16M +KERNEL_ENTRY = 0x80101000 +RAMSIZE = 0x00100000 # 1MB +IMAGE_COPY = 1 + +LOADER_MAKEOPTS= \ + KDIR=$(KDIR) \ + LOADADDR=$(LOADADDR) \ + KERNEL_ENTRY=$(KERNEL_ENTRY) \ + RAMSIZE=$(RAMSIZE) \ + IMAGE_COPY=$(IMAGE_COPY) + +define Build/Clean + $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean +endef + +define Image/Prepare + cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma + $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile +ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) + $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-initramfs '$(strip $(call Image/cmdline/yaffs2)) ' + cat $(KDIR)/vmlinux-initramfs | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux-initramfs.lzma + $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile + $(CP) $(KDIR)/loader.elf $(KDIR)/loader-initramfs.elf +endif +endef + +VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux-kernel + +define Image/BuildKernel + $(CP) $(KDIR)/loader.elf $(VMLINUX) +ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) + $(CP) $(KDIR)/loader-initramfs.elf $(BIN_DIR)/$(IMG_PREFIX)-vmlinux-initramfs +endif +endef + +define Image/cmdline/jffs2-64k +block2mtd.block2mtd=/dev/sda2,65536 root=/dev/mtdblock2 rootfstype=jffs2 +endef + +define Image/cmdline/jffs2-128k +block2mtd.block2mtd=/dev/sda2,131072 root=/dev/mtdblock2 rootfstype=jffs2 +endef + +define Image/cmdline/ext4 +root=/dev/sda2 rootfstype=ext4 +endef + +define Image/cmdline/squashfs +block2mtd.block2mtd=/dev/sda2,65536,rootfs root=/dev/mtdblock2 rootfstype=squashfs +endef + +define Image/cmdline/yaffs2 +root=/dev/mtdblock1 rootfstype=yaffs2 +endef + +define Image/Build/squashfs + $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) +endef + +define Image/Build + $(call Image/Build/$(1),$(1)) + $(CP) $(KDIR)/vmlinux.elf $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel + $(STAGING_DIR_HOST)/bin/patch-cmdline $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel '$(strip $(call Image/cmdline/$(1))) ' + ./gen_image.sh $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).bin \ + 4 $(BIN_DIR)/$(IMG_PREFIX)-$(1).kernel \ + $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(KDIR)/root.$(1) \ + 128 +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/rb532/image/gen_image.sh b/target/linux/rb532/image/gen_image.sh new file mode 100755 index 0000000..a2d6f40 --- /dev/null +++ b/target/linux/rb532/image/gen_image.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +OUTPUT="$1" +KERNELSIZE="$2" +KERNELIMAGE="$3" +ROOTFSSIZE="$4" +ROOTFSIMAGE="$5" +ALIGN="$6" + +rm -f "$OUTPUT" + +# create partition table +set `ptgen -o "$OUTPUT" -h 16 -s 32 -l ${ALIGN} -t 0x27 -p ${KERNELSIZE}m -t 0x83 -p ${ROOTFSSIZE}m` + +KERNELOFFSET="$(($1 / 512))" +ROOTFSOFFSET="$(($3 / 512))" + +dd if="$KERNELIMAGE" of="$OUTPUT" bs=512 conv=notrunc seek="$KERNELOFFSET" +dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 conv=notrunc seek="$ROOTFSOFFSET" diff --git a/target/linux/rb532/modules.mk b/target/linux/rb532/modules.mk new file mode 100644 index 0000000..0cbbdab --- /dev/null +++ b/target/linux/rb532/modules.mk @@ -0,0 +1,45 @@ +# +# Copyright (C) 2010 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define KernelPackage/ata-rb532-cf + SUBMENU:=$(BLOCK_MENU) + TITLE:=RB532 Compact Flash support + DEPENDS:=@TARGET_rb532 @BROKEN + KCONFIG:= \ + CONFIG_PATA_PLATFORM \ + CONFIG_PATA_RB532 + FILES:=\ + $(LINUX_DIR)/drivers/ata/pata_platform.ko \ + $(LINUX_DIR)/drivers/ata/pata_rb532_cf.ko + AUTOLOAD:=$(call AutoLoad,41,pata_platform pata_rb532_cf,1) + $(call AddDepends/ata) +endef + +define KernelPackage/ata-rb532-cf/description + RB532 Compact Flash support. +endef + +$(eval $(call KernelPackage,ata-rb532-cf)) + + +define KernelPackage/input-rb532 + SUBMENU:=$(OTHER_MENU) + TITLE:=RB532 button device support + DEPENDS:=@TARGET_rb532 +kmod-input-polldev + KCONFIG:= \ + CONFIG_INPUT_MISC=y \ + CONFIG_INPUT_RB532_BUTTON + FILES:=$(LINUX_DIR)/drivers/input/misc/rb532_button.ko + AUTOLOAD:=$(call AutoLoad,62,rb532_button) + $(call AddDepends/input) +endef + +define KernelPackage/input-rb532/description + Kernel module for RB532 button +endef + +$(eval $(call KernelPackage,input-rb532)) diff --git a/target/linux/rb532/patches/001-cmdline_hack.patch b/target/linux/rb532/patches/001-cmdline_hack.patch new file mode 100644 index 0000000..a39da9c --- /dev/null +++ b/target/linux/rb532/patches/001-cmdline_hack.patch @@ -0,0 +1,20 @@ +--- a/arch/mips/rb532/prom.c ++++ b/arch/mips/rb532/prom.c +@@ -67,6 +67,7 @@ static inline unsigned long tag2ul(char + return simple_strtoul(num, 0, 10); + } + ++extern char __image_cmdline[]; + void __init prom_setup_cmdline(void) + { + static char cmd_line[COMMAND_LINE_SIZE] __initdata; +@@ -108,6 +109,9 @@ void __init prom_setup_cmdline(void) + } + *(cp++) = ' '; + ++ strcpy(cp,(__image_cmdline)); ++ cp += strlen(__image_cmdline); ++ + i = strlen(arcs_cmdline); + if (i > 0) { + *(cp++) = ' '; diff --git a/target/linux/rb532/patches/002-rb532_nand_fixup.patch b/target/linux/rb532/patches/002-rb532_nand_fixup.patch new file mode 100644 index 0000000..6f88599 --- /dev/null +++ b/target/linux/rb532/patches/002-rb532_nand_fixup.patch @@ -0,0 +1,47 @@ +--- a/arch/mips/rb532/devices.c ++++ b/arch/mips/rb532/devices.c +@@ -140,6 +140,19 @@ static struct platform_device cf_slot0 = + }; + + /* Resources and device for NAND */ ++ ++/* ++ * We need to use the OLD Yaffs-1 OOB layout, otherwise the RB bootloader ++ * will not be able to find the kernel that we load. So set the oobinfo ++ * when creating the partitions ++ */ ++static struct nand_ecclayout rb532_nand_ecclayout = { ++ .eccbytes = 6, ++ .eccpos = { 8, 9, 10, 13, 14, 15 }, ++ .oobavail = 9, ++ .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } } ++}; ++ + static int rb532_dev_ready(struct mtd_info *mtd) + { + return gpio_get_value(GPIO_RDY); +@@ -254,6 +267,16 @@ static struct platform_device *rb532_dev + /* NAND definitions */ + #define NAND_CHIP_DELAY 25 + ++static int rb532_nand_fixup(struct mtd_info *mtd) ++{ ++ struct nand_chip *chip = mtd->priv; ++ ++ if (mtd->writesize == 512) ++ chip->ecc.layout = &rb532_nand_ecclayout; ++ ++ return 0; ++} ++ + static void __init rb532_nand_setup(void) + { + switch (mips_machtype) { +@@ -272,6 +295,7 @@ static void __init rb532_nand_setup(void + rb532_nand_data.chip.nr_partitions = ARRAY_SIZE(rb532_partition_info); + rb532_nand_data.chip.partitions = rb532_partition_info; + rb532_nand_data.chip.chip_delay = NAND_CHIP_DELAY; ++ rb532_nand_data.chip.chip_fixup = &rb532_nand_fixup; + } + + diff --git a/target/linux/rb532/patches/004-rb532_partition_info-rename-rootfs-to-rootfs_onboard.patch b/target/linux/rb532/patches/004-rb532_partition_info-rename-rootfs-to-rootfs_onboard.patch new file mode 100644 index 0000000..ad4dfc4 --- /dev/null +++ b/target/linux/rb532/patches/004-rb532_partition_info-rename-rootfs-to-rootfs_onboard.patch @@ -0,0 +1,11 @@ +--- a/arch/mips/rb532/devices.c ++++ b/arch/mips/rb532/devices.c +@@ -202,7 +202,7 @@ static struct mtd_partition rb532_partit + .offset = 0, + .size = 4 * 1024 * 1024, + }, { +- .name = "rootfs", ++ .name = "rootfs_onboard", + .offset = MTDPART_OFS_NXTBLK, + .size = MTDPART_SIZ_FULL, + } diff --git a/target/linux/rb532/src/patch-cmdline.c b/target/linux/rb532/src/patch-cmdline.c new file mode 100644 index 0000000..571f848 --- /dev/null +++ b/target/linux/rb532/src/patch-cmdline.c @@ -0,0 +1,79 @@ +/* + * patch-cmdline.c - patch the kernel command line on rb532 + * + * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stddef.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <string.h> + +#define SEARCH_SPACE (16 * 1024) +#define CMDLINE_MAX 512 + +int main(int argc, char **argv) +{ + int fd, found = 0, len, ret = -1; + char *ptr, *p; + + if (argc != 3) { + fprintf(stderr, "Usage: %s <file> <cmdline>\n", argv[0]); + goto err1; + } + len = strlen(argv[2]); + if (len + 9 > CMDLINE_MAX) { + fprintf(stderr, "Command line string too long\n"); + goto err1; + } + + if (((fd = open(argv[1], O_RDWR)) < 0) || + (ptr = (char *) mmap(0, SEARCH_SPACE + CMDLINE_MAX, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) == (void *) (-1)) { + fprintf(stderr, "Could not open kernel image"); + goto err2; + } + + for (p = ptr; p < (ptr + SEARCH_SPACE); p += 4) { + if (memcmp(p, "CMDLINE:", 8) == 0) { + found = 1; + p += 8; + break; + } + } + if (!found) { + fprintf(stderr, "Command line marker not found!\n"); + goto err3; + } + + memset(p, 0, CMDLINE_MAX - 8); + strcpy(p, argv[2]); + msync(p, CMDLINE_MAX, MS_SYNC|MS_INVALIDATE); + ret = 0; + +err3: + munmap((void *) ptr, len); +err2: + if (fd > 0) + close(fd); +err1: + return ret; +} |