From da4a7137abb7447e2aeeeb8955c566ae7b24cea6 Mon Sep 17 00:00:00 2001 From: claudio Date: Sun, 8 Feb 2009 14:32:21 +0000 Subject: [etrax] Initial kernel support for 2.6.28.4 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@14446 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../etrax/patches-2.6.28/100-compile-fixes.patch | 97 ++++++++++++++++++++++ .../etrax/patches-2.6.28/200-samsung_flash.patch | 13 +++ .../linux/etrax/patches-2.6.28/201-flashsize.patch | 92 ++++++++++++++++++++ 3 files changed, 202 insertions(+) create mode 100644 target/linux/etrax/patches-2.6.28/100-compile-fixes.patch create mode 100644 target/linux/etrax/patches-2.6.28/200-samsung_flash.patch create mode 100644 target/linux/etrax/patches-2.6.28/201-flashsize.patch (limited to 'target/linux/etrax/patches-2.6.28') diff --git a/target/linux/etrax/patches-2.6.28/100-compile-fixes.patch b/target/linux/etrax/patches-2.6.28/100-compile-fixes.patch new file mode 100644 index 000000000..ac448be60 --- /dev/null +++ b/target/linux/etrax/patches-2.6.28/100-compile-fixes.patch @@ -0,0 +1,97 @@ +Index: linux-2.6.28/arch/cris/Makefile +=================================================================== +--- linux-2.6.28.orig/arch/cris/Makefile 2008-12-25 00:26:37.000000000 +0100 ++++ linux-2.6.28/arch/cris/Makefile 2009-01-09 22:52:39.000000000 +0100 +@@ -40,7 +40,7 @@ + + LD = $(CROSS_COMPILE)ld -mcrislinux + +-OBJCOPYFLAGS := -O binary -R .note -R .comment -S ++OBJCOPYFLAGS := -O binary -R .bss -R .note -R .note.gnu.build-id -R .comment -S + + CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE) + +Index: linux-2.6.28/arch/cris/arch-v10/boot/Makefile +=================================================================== +--- linux-2.6.28.orig/arch/cris/arch-v10/boot/Makefile 2008-12-25 00:26:37.000000000 +0100 ++++ linux-2.6.28/arch/cris/arch-v10/boot/Makefile 2009-01-09 22:52:39.000000000 +0100 +@@ -13,7 +13,6 @@ + + $(obj)/compressed/vmlinux: $(obj)/Image FORCE + $(Q)$(MAKE) $(build)=$(obj)/compressed $@ +- $(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin + + $(obj)/zImage: $(obj)/compressed/vmlinux + @cp $< $@ +Index: linux-2.6.28/arch/cris/arch-v10/boot/compressed/misc.c +=================================================================== +--- linux-2.6.28.orig/arch/cris/arch-v10/boot/compressed/misc.c 2008-12-25 00:26:37.000000000 +0100 ++++ linux-2.6.28/arch/cris/arch-v10/boot/compressed/misc.c 2009-01-10 18:00:45.000000000 +0100 +@@ -5,7 +5,7 @@ + * adapted for Linux. + * + * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 +- * puts by Nick Holloway 1993, better puts by Martin Mares 1995 ++ * putstr by Nick Holloway 1993, better putstr by Martin Mares 1995 + * adaptation for Linux/CRIS Axis Communications AB, 1999 + * + */ +@@ -102,7 +102,6 @@ + static long bytes_out = 0; + static uch *output_data; + static unsigned long output_ptr = 0; +-static void puts(const char *); + + /* the "heap" is put directly after the BSS ends, at end */ + +@@ -115,7 +114,7 @@ + /* decompressor info and error messages to serial console */ + + static void +-puts(const char *s) ++putstr(const char *s) + { + #ifndef CONFIG_ETRAX_DEBUG_PORT_NULL + while (*s) { +@@ -188,9 +187,9 @@ + + static void error(char *x) + { +- puts("\n\n"); +- puts(x); +- puts("\n\n -- System halted\n"); ++ putstr("\n\n"); ++ putstr(x); ++ putstr("\n\n -- System halted\n"); + + while (1); /* Halt */ + } +@@ -236,11 +235,11 @@ + + __asm__ volatile ("move $vr,%0" : "=rm" (revision)); + if (revision < 10) { +- puts("You need an ETRAX 100LX to run linux 2.6\n"); ++ putstr("You need an ETRAX 100LX to run linux 2.6\n"); + while (1); + } + +- puts("Uncompressing Linux...\n"); ++ putstr("Uncompressing Linux...\n"); + gunzip(); +- puts("Done. Now booting the kernel.\n"); ++ putstr("Done. Now booting the kernel.\n"); + } +Index: linux-2.6.28/arch/cris/arch-v10/mm/init.c +=================================================================== +--- linux-2.6.28.orig/arch/cris/arch-v10/mm/init.c 2008-12-25 00:26:37.000000000 +0100 ++++ linux-2.6.28/arch/cris/arch-v10/mm/init.c 2009-01-09 22:52:39.000000000 +0100 +@@ -184,6 +184,9 @@ + + free_area_init_node(0, zones_size, PAGE_OFFSET >> PAGE_SHIFT, 0); + } ++void free_initrd_mem(unsigned long start, unsigned long end) ++{ ++} + + /* Initialize remaps of some I/O-ports. It is important that this + * is called before any driver is initialized. diff --git a/target/linux/etrax/patches-2.6.28/200-samsung_flash.patch b/target/linux/etrax/patches-2.6.28/200-samsung_flash.patch new file mode 100644 index 000000000..5df6590fa --- /dev/null +++ b/target/linux/etrax/patches-2.6.28/200-samsung_flash.patch @@ -0,0 +1,13 @@ +Index: linux-2.6.28.2/drivers/mtd/chips/cfi_cmdset_0002.c +=================================================================== +--- linux-2.6.28.2.orig/drivers/mtd/chips/cfi_cmdset_0002.c 2009-02-04 13:42:19.000000000 +0100 ++++ linux-2.6.28.2/drivers/mtd/chips/cfi_cmdset_0002.c 2009-02-04 13:44:11.000000000 +0100 +@@ -364,7 +364,7 @@ + return NULL; + } + +- if (extp->MajorVersion != '1' || ++ if (extp->MajorVersion < '1' || extp->MajorVersion > '3' || + (extp->MinorVersion < '0' || extp->MinorVersion > '4')) { + if (cfi->mfr == MANUFACTURER_SAMSUNG && + (extp->MajorVersion == '3' && extp->MinorVersion == '3')) { diff --git a/target/linux/etrax/patches-2.6.28/201-flashsize.patch b/target/linux/etrax/patches-2.6.28/201-flashsize.patch new file mode 100644 index 000000000..e825acf1f --- /dev/null +++ b/target/linux/etrax/patches-2.6.28/201-flashsize.patch @@ -0,0 +1,92 @@ +Index: linux-2.6.28.2/arch/cris/arch-v10/drivers/axisflashmap.c +=================================================================== +--- linux-2.6.28.2.orig/arch/cris/arch-v10/drivers/axisflashmap.c 2009-02-04 13:49:34.000000000 +0100 ++++ linux-2.6.28.2/arch/cris/arch-v10/drivers/axisflashmap.c 2009-02-04 13:55:30.000000000 +0100 +@@ -113,7 +113,7 @@ + + /* If no partition-table was found, we use this default-set. */ + #define MAX_PARTITIONS 7 +-#define NUM_DEFAULT_PARTITIONS 3 ++#define NUM_DEFAULT_PARTITIONS 2 + + /* + * Default flash size is 2MB. CONFIG_ETRAX_PTABLE_SECTOR is most likely the +@@ -122,19 +122,14 @@ + */ + static struct mtd_partition axis_default_partitions[NUM_DEFAULT_PARTITIONS] = { + { +- .name = "boot firmware", +- .size = CONFIG_ETRAX_PTABLE_SECTOR, +- .offset = 0 +- }, +- { + .name = "kernel", +- .size = 0x200000 - (6 * CONFIG_ETRAX_PTABLE_SECTOR), +- .offset = CONFIG_ETRAX_PTABLE_SECTOR ++ .size = 0x00, ++ .offset = 0 + }, + { +- .name = "filesystem", +- .size = 5 * CONFIG_ETRAX_PTABLE_SECTOR, +- .offset = 0x200000 - (5 * CONFIG_ETRAX_PTABLE_SECTOR) ++ .name = "rootfs", ++ .size = 0x200000, ++ .offset = 0x200000 + } + }; + +@@ -281,6 +276,11 @@ + struct partitiontable_entry *ptable; + int use_default_ptable = 1; /* Until proven otherwise. */ + const char pmsg[] = " /dev/flash%d at 0x%08x, size 0x%08x\n"; ++ unsigned int kernel_part_size = 0; ++ unsigned char *flash_mem = (unsigned char*)(FLASH_CACHED_ADDR); ++ unsigned int flash_scan_count = 0; ++ const char *part_magic = "ACME_PART_MAGIC"; ++ unsigned int magic_len = strlen(part_magic); + + if (!(mymtd = flash_probe())) { + /* There's no reason to use this module if no flash chip can +@@ -293,6 +293,31 @@ + axisflash_mtd = mymtd; + } + ++ /* scan flash to findout where out partition starts */ ++ ++ printk(KERN_INFO "Scanning flash for end of kernel magic\n"); ++ for(flash_scan_count = 0; flash_scan_count < 100000; flash_scan_count++) { ++ if(strncmp(&flash_mem[flash_scan_count], part_magic, magic_len - 1) == 0) { ++ kernel_part_size = flash_mem[flash_scan_count + magic_len ]; ++ kernel_part_size <<= 8; ++ kernel_part_size += flash_mem[flash_scan_count + magic_len + 2]; ++ kernel_part_size <<= 8; ++ kernel_part_size += flash_mem[flash_scan_count + magic_len + 1]; ++ kernel_part_size <<= 8; ++ kernel_part_size += flash_mem[flash_scan_count + magic_len + 3]; ++ printk(KERN_INFO "Kernel ends at 0x%.08X\n", kernel_part_size); ++ flash_scan_count = 1100000; ++ } ++ } ++ ++ ++ if(kernel_part_size){ ++ kernel_part_size = (kernel_part_size & 0xffff0000); ++ axis_default_partitions[0].size = kernel_part_size; ++ axis_default_partitions[1].size = mymtd->size - axis_default_partitions[0].size; ++ axis_default_partitions[1].offset = axis_default_partitions[0].size; ++ } ++ + if (mymtd) { + mymtd->owner = THIS_MODULE; + ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR + +Index: linux-2.6.28.2/arch/cris/arch-v10/lib/hw_settings.S +=================================================================== +--- linux-2.6.28.2.orig/arch/cris/arch-v10/lib/hw_settings.S 2009-02-04 13:48:25.000000000 +0100 ++++ linux-2.6.28.2/arch/cris/arch-v10/lib/hw_settings.S 2009-02-04 13:49:04.000000000 +0100 +@@ -60,3 +60,5 @@ + .dword R_PORT_PB_SET + .dword PB_SET_VALUE + .dword 0 ; No more register values ++ .ascii "ACME_PART_MAGIC" ++ .dword 0xdeadc0de -- cgit v1.2.3