From 077d48b9313aced4aabf7125fc9a54f4bf9f37ab Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Thu, 01 Aug 2019 18:16:15 +0800
Subject: [PATCH] update linux kernel, u-boot patch. adjust partition table, update rootfs build shell script to new partition. test ok
---
ok335xD/linux-bsp/patches/u-boot-2011.09-ok335x.patch | 204 +++++++++++++++++++++++++++++++++
ok335xD/linux-bsp/patches/linux-3.2.0-ok335x.patch | 132 +++++++++++++++++++++-
ok335xD/linux-bsp/build.sh | 2
3 files changed, 327 insertions(+), 11 deletions(-)
diff --git a/ok335xD/linux-bsp/build.sh b/ok335xD/linux-bsp/build.sh
index 911916c..eb02384 100755
--- a/ok335xD/linux-bsp/build.sh
+++ b/ok335xD/linux-bsp/build.sh
@@ -121,7 +121,7 @@
mode=ubi
image=ubi.img
vol_id=0
-vol_size=231MiB
+vol_size=140MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
diff --git a/ok335xD/linux-bsp/patches/linux-3.2.0-ok335x.patch b/ok335xD/linux-bsp/patches/linux-3.2.0-ok335x.patch
index c9c12df..2e442b6 100644
--- a/ok335xD/linux-bsp/patches/linux-3.2.0-ok335x.patch
+++ b/ok335xD/linux-bsp/patches/linux-3.2.0-ok335x.patch
@@ -1,20 +1,121 @@
diff -Nuar linux-3.2.0/arch/arm/mach-omap2/board-am335xevm.c linux-3.2.0-ok335x/arch/arm/mach-omap2/board-am335xevm.c
--- linux-3.2.0/arch/arm/mach-omap2/board-am335xevm.c 2014-01-22 18:20:21.000000000 +0800
-+++ linux-3.2.0-ok335x/arch/arm/mach-omap2/board-am335xevm.c 2019-07-29 13:35:32.026115491 +0800
-@@ -2160,8 +2160,8 @@
++++ linux-3.2.0-ok335x/arch/arm/mach-omap2/board-am335xevm.c 2019-08-01 12:55:20.735041318 +0800
+@@ -2017,47 +2017,38 @@
+ am33xx_register_ehrpwm(2, &pwm_pdata[2]);
+ }
+
+-/* NAND partition information */
++
++/* NAND(MT29F2G08ABAEAWP, 256M) partition information, modify partition by guowenxue */
+ static struct mtd_partition am335x_nand_partitions[] = {
+ /* All the partition sizes are listed in terms of NAND block size */
+ {
+ .name = "SPL",
+- .offset = 0, /* Offset = 0x0 */
+- .size = SZ_128K,
+- },
+- {
+- .name = "SPL.backup1",
+- .offset = MTDPART_OFS_APPEND, /* Offset = 0x20000 */
+- .size = SZ_128K,
+- },
+- {
+- .name = "SPL.backup2",
+- .offset = MTDPART_OFS_APPEND, /* Offset = 0x40000 */
+- .size = SZ_128K,
+- },
+- {
+- .name = "SPL.backup3",
+- .offset = MTDPART_OFS_APPEND, /* Offset = 0x60000 */
+- .size = SZ_128K,
++ .offset = 0, /* Offset = 0x000000 */
++ .size = 1*SZ_512K,
+ },
+ {
+ .name = "U-Boot",
+- .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
+- .size = 15 * SZ_128K,
++ .offset = MTDPART_OFS_APPEND, /* Offset = 0x080000 */
++ .size = 1*SZ_256K,
+ },
+ {
+ .name = "U-Boot Env",
+- .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */
+- .size = 1 * SZ_128K,
++ .offset = MTDPART_OFS_APPEND, /* Offset = 0x0C0000 */
++ .size = 1*SZ_256K,
+ },
+ {
+ .name = "Kernel",
+- .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
+- .size = 40 * SZ_128K,
++ .offset = MTDPART_OFS_APPEND, /* Offset = 0x100000 */
++ .size = 5*SZ_1M,
+ },
+ {
+- .name = "File System",
+- .offset = MTDPART_OFS_APPEND, /* Offset = 0x780000 */
++ .name = "Rootfs",
++ .offset = MTDPART_OFS_APPEND, /* Offset = 0x600000 */
++ .size = 150*SZ_1M,
++ },
++ {
++ .name = "Apps",
++ .offset = MTDPART_OFS_APPEND, /* Offset = 0x9c00000 */
+ .size = MTDPART_SIZ_FULL,
+ },
+ };
+@@ -2160,8 +2151,10 @@
&am335x_nand_timings);
if (!pdata)
return;
-// pdata->ecc_opt =OMAP_ECC_BCH8_CODE_HW;
- pdata->ecc_opt =OMAP_ECC_HAMMING_CODE_DEFAULT;
-+ pdata->ecc_opt =OMAP_ECC_BCH8_CODE_HW;
++
++ /* Modify by guowenxue, kernel & rootfs must use ECC_BCH8 in u-boot */
++ pdata->ecc_opt =OMAP_ECC_BCH8_CODE_HW;
+ //pdata->ecc_opt =OMAP_ECC_HAMMING_CODE_DEFAULT;
pdata->elm_used = true;
gpmc_device[0].pdata = pdata;
+@@ -3121,10 +3114,15 @@
+
+ static int __init screentype_setup(char *str)
+ {
++ /* Modify by guowenxue, our OK335XD use 800x480-7" capacitive LCD */
++ screen_type = SCREEN_TYPE_C;
++
++#if 0
+ if(!strncmp(str,"C",1))
+ screen_type = SCREEN_TYPE_C;
+ else
+ screen_type = SCREEN_TYPE_R;
++#endif
+
+ return 1;
+ }
+@@ -3132,6 +3130,9 @@
+
+ static int __init screensize_setup(char *str)
+ {
++ /* Modify by guowenxue, our OK335XD use 800x480-7" capacitive LCD */
++ screen_size = SCREEN_SIZE_800X480_7;
++#if 0
+ if(!strncmp(str,"800x600-8",9))
+ screen_size = SCREEN_SIZE_800X600_8;
+ else if(!strncmp(str,"800x480-5",9))
+@@ -3142,6 +3143,7 @@
+ screen_size = SCREEN_SIZE_800X600_10;
+ else
+ screen_size = SCREEN_SIZE_480X272_4;
++#endif
+
+ return 1;
+ }
diff -Nuar linux-3.2.0/build.sh linux-3.2.0-ok335x/build.sh
--- linux-3.2.0/build.sh 1970-01-01 08:00:00.000000000 +0800
-+++ linux-3.2.0-ok335x/build.sh 2019-07-29 13:34:57.430114827 +0800
++++ linux-3.2.0-ok335x/build.sh 2019-08-01 12:52:36.239038163 +0800
@@ -0,0 +1,74 @@
+#!/bin/bash
+
@@ -92,7 +193,7 @@
+
diff -Nuar linux-3.2.0/.cfg-ok335x linux-3.2.0-ok335x/.cfg-ok335x
--- linux-3.2.0/.cfg-ok335x 1970-01-01 08:00:00.000000000 +0800
-+++ linux-3.2.0-ok335x/.cfg-ok335x 2019-07-29 13:30:10.022109314 +0800
++++ linux-3.2.0-ok335x/.cfg-ok335x 2019-08-01 12:55:57.327042020 +0800
@@ -0,0 +1,2936 @@
+#
+# Automatically generated file; DO NOT EDIT.
@@ -3030,9 +3131,28 @@
+CONFIG_NLATTR=y
+CONFIG_AVERAGE=y
+# CONFIG_CORDIC is not set
+diff -Nuar linux-3.2.0/ChangeLog.txt linux-3.2.0-ok335x/ChangeLog.txt
+--- linux-3.2.0/ChangeLog.txt 1970-01-01 08:00:00.000000000 +0800
++++ linux-3.2.0-ok335x/ChangeLog.txt 2019-08-01 12:52:36.243038163 +0800
+@@ -0,0 +1,15 @@
++
++1. Nandflash(MT29F2G08ABAEAWP, 256M) Partition
++-----------------------------------------------
++
++arch/arm/mach-omap2/board-am335xevm.c:
++
++0x000000000000-0x000000080000 : "SPL"
++0x000000080000-0x0000000c0000 : "U-Boot"
++0x0000000c0000-0x000000100000 : "U-Boot Env"
++0x000000100000-0x000000600000 : "Kernel"
++0x000000600000-0x000009c00000 : "Rootfs"
++0x000009c00000-0x000010000000 : "Apps"
++
++
++
diff -Nuar linux-3.2.0/Makefile linux-3.2.0-ok335x/Makefile
--- linux-3.2.0/Makefile 2019-07-28 20:25:29.000000000 +0800
-+++ linux-3.2.0-ok335x/Makefile 2019-07-29 13:07:08.678082816 +0800
++++ linux-3.2.0-ok335x/Makefile 2019-08-01 12:52:36.259038163 +0800
@@ -192,8 +192,8 @@
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
diff --git a/ok335xD/linux-bsp/patches/u-boot-2011.09-ok335x.patch b/ok335xD/linux-bsp/patches/u-boot-2011.09-ok335x.patch
index b5265ec..d8c0388 100644
--- a/ok335xD/linux-bsp/patches/u-boot-2011.09-ok335x.patch
+++ b/ok335xD/linux-bsp/patches/u-boot-2011.09-ok335x.patch
@@ -1,7 +1,7 @@
diff -Nuar u-boot-2011.09/build.sh u-boot-2011.09-ok335x/build.sh
--- u-boot-2011.09/build.sh 1970-01-01 08:00:00.000000000 +0800
-+++ u-boot-2011.09-ok335x/build.sh 2019-07-29 13:42:52.862123947 +0800
-@@ -0,0 +1,66 @@
++++ u-boot-2011.09-ok335x/build.sh 2019-08-01 16:36:13.003295528 +0800
+@@ -0,0 +1,67 @@
+#!/bin/bash
+
+TFTP_PATH=/tftp
@@ -9,7 +9,8 @@
+IMG_NAME="u-boot.img MLO"
+
+CROSSTOOL=/opt/crosstool/cortex-a7/bin/arm-linux-gnueabi-
-+JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
++#JOBS=`cat /proc/cpuinfo |grep "processor"|wc -l`
++JOBS=1
+
+
+function do_clean()
@@ -68,9 +69,204 @@
+do_install
+
+
+diff -Nuar u-boot-2011.09/include/configs/ok335x.h u-boot-2011.09-ok335x/include/configs/ok335x.h
+--- u-boot-2011.09/include/configs/ok335x.h 2014-01-23 09:45:03.000000000 +0800
++++ u-boot-2011.09-ok335x/include/configs/ok335x.h 2019-08-01 18:04:47.259397469 +0800
+@@ -61,17 +61,11 @@
+ "nandroot=ubi0:rootfs rw ubi.mtd=7,2048\0" \
+ "nandrootfstype=ubifs rootwait=1\0"
+ #else
+-#define CON \
+- "console=ttyO0,115200n8\0" \
+- "optargs=\0" \
+- "mmcroot=/dev/mmcblk0p2 ro\0" \
+- "mmcrootfstype=ext3 rootwait\0" \
+- "nandroot=ubi0:rootfs rw ubi.mtd=7,2048\0" \
+- "nandrootfstype=ubifs rootwait=1\0"
++#define CON "console=ttyO0,115200n8\0"
+ #endif
+
+ /* set to negative value for no autoboot */
+-#define CONFIG_BOOTDELAY 3
++#define CONFIG_BOOTDELAY 1
+
+ #define CONFIG_MMC
+ #define CONFIG_NAND
+@@ -81,141 +75,30 @@
+ #define CONFIG_CFB_CONSOLE
+ #define CONFIG_VGA_AS_SINGLE_DEVICE
+
++#define CONFIG_BOOTARGS "console=ttyO0,115200n8 root=ubi0:rootfs rw ubi.mtd=4,2048 rootfstype=ubifs rootwait=1"
++#define CONFIG_BOOTCOMMAND "run confaddr; nandecc hw 2; nand read ${loadaddr} ${kernaddr} ${kernsize}; bootm ${loadaddr}"
++#define CONFIG_IPADDR 192.168.2.222
++#define CONFIG_SERVERIP 192.168.2.2
++#define CONFIG_BOOTFILE uImage
++#define CONFIG_LOADADDR 0x80200000
+
+-#if 1
+ #define CONFIG_EXTRA_ENV_SETTINGS \
+- CON \
+- "screentype=R\0"\
+- "screensize=800x480-7\0"\
+- "loadaddr=0x80200000\0" \
+- "kloadaddr=0x80007fc0\0" \
+- "fdtaddr=0x80F80000\0" \
+- "fdt_high=0xffffffff\0" \
+- "rdaddr=0x81000000\0" \
+- "bootdev=MMC\0"\
+- "bootfile=uImage\0" \
+- "fdtfile=\0" \
+- "mmcdev=0\0" \
+- "nandsrcaddr=0x280000\0" \
+- "nandimgsize=0x500000\0" \
+- "rootpath=/export/rootfs\0" \
+- "nfsopts=nolock\0" \
+- "static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}" \
+- "::off\0" \
+- "ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M\0" \
+- "ramrootfstype=ext2\0" \
+- "ip_method=none\0" \
+- "bootargs_defaults=setenv bootargs " \
+- "console=${console} " \
+- "${optargs}\0" \
+- "mmcargs=run bootargs_defaults;" \
+- "setenv bootargs ${bootargs} " \
+- "root=${mmcroot} " \
+- "rootfstype=${mmcrootfstype} ip=${ip_method} screentype=${screentype} screensize=${screensize}\0" \
+- "nandargs=setenv bootargs console=${console} " \
+- "${optargs} " \
+- "root=${nandroot} " \
+- "rootfstype=${nandrootfstype} screentype=${screentype} screensize=${screensize}\0" \
+- "spiroot=/dev/mtdblock4 rw\0" \
+- "spirootfstype=jffs2\0" \
+- "spisrcaddr=0xe0000\0" \
+- "spiimgsize=0x362000\0" \
+- "spibusno=0\0" \
+- "spiargs=setenv bootargs console=${console} " \
+- "${optargs} " \
+- "root=${spiroot} " \
+- "rootfstype=${spirootfstype}\0" \
+- "netargs=setenv bootargs console=${console} " \
+- "${optargs} " \
+- "root=/dev/nfs " \
+- "nfsroot=${serverip}:${rootpath},${nfsopts} rw " \
+- "ip=dhcp\0" \
+- "bootenv=uEnv.txt\0" \
+- "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
+- "importbootenv=echo Importing environment from mmc ...; " \
+- "env import -t $loadaddr $filesize\0" \
+- "ramargs=setenv bootargs console=${console} " \
+- "${optargs} " \
+- "root=${ramroot} " \
+- "rootfstype=${ramrootfstype}\0" \
+- "loadramdisk=fatload mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
+- "loaduimagefat=fatload mmc ${mmcdev} ${kloadaddr} ${bootfile}\0" \
+- "loaduimage=ext2load mmc ${mmcdev}:2 ${kloadaddr} /boot/${bootfile}\0" \
+- "mmcboot=echo Booting from mmc ...; " \
+- "run mmcargs; " \
+- "bootm ${kloadaddr}\0" \
+- "nandboot=echo Booting from nand ...; " \
+- "run nandargs; " \
+- "nandecc hw 2;"\
+- "nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; " \
+- "bootm ${loadaddr}\0" \
+- "spiboot=echo Booting from spi ...; " \
+- "run spiargs; " \
+- "sf probe ${spibusno}:0; " \
+- "sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; " \
+- "bootm ${loadaddr}\0" \
+- "netboot=echo Booting from network ...; " \
+- "setenv autoload no; " \
+- "dhcp; " \
+- "tftp ${loadaddr} ${bootfile}; " \
+- "run netargs; " \
+- "bootm ${loadaddr}\0" \
+- "ramboot=echo Booting from ramdisk ...; " \
+- "run ramargs; " \
+- "bootm ${loadaddr}\0" \
+- "findfdt="\
+- "if test $board_name = A335BONE; then " \
+- "setenv fdtfile am335x-bone.dtb; fi; " \
+- "if test $board_name = A33515BB; then " \
+- "setenv fdtfile am335x-evm.dtb; fi; " \
+- "if test $board_name = A335X_SK; then " \
+- "setenv fdtfile am335x-evmsk.dtb; fi\0" \
+- "auto_update_nand= echo ---------------Begin update system to Nand---------------;led all on;"\
+- "setenv TYPE 0;nand erase.chip;mmc rescan; "\
+- "setenv TYPE 1;fatload mmc 0 80A00000 MLO; setenv TYPE 2;nandecc hw 2;nand write.i 80A00000 0 ${filesize}; "\
+- "setenv TYPE 3;fatload mmc 0 80A00000 u-boot.img;setenv TYPE 4;nandecc hw 2;nand write.i 80A00000 80000 ${filesize}; "\
+- "setenv TYPE 5;fatload mmc 0 80A00000 uImage; setenv TYPE 6;nandecc hw 2;nand write.i 80A00000 280000 ${filesize}; "\
+- "setenv TYPE 7;fatload mmc 0 80A00000 ubi.img; setenv TYPE 8;nandecc sw;nand write.i 80A00000 780000 ${filesize};"\
+- "echo ;"\
+- "echo --------------Update system to Nand success--------------;led flash all;\0"\
+- "update_nand= echo ---------------Begin update system to Nand---------------;led all on;"\
+- "setenv TYPE 0;nand erase.chip;mmc rescan; "\
+- "setenv TYPE 1;fatload mmc 0 80A00000 MLO; setenv TYPE 2;nandecc hw 2;nand write.i 80A00000 0 ${filesize}; "\
+- "setenv TYPE 3;fatload mmc 0 80A00000 u-boot.img;setenv TYPE 4;nandecc hw 2;nand write.i 80A00000 80000 ${filesize}; "\
+- "setenv TYPE 5;fatload mmc 0 80A00000 uImage; setenv TYPE 6;nandecc hw 2;nand write.i 80A00000 280000 ${filesize}; "\
+- "setenv TYPE 7;fatload mmc 0 80A00000 ubi.img; setenv TYPE 8;nandecc sw;nand write.i 80A00000 780000 ${filesize};"\
+- "echo ;"\
+- "echo --------------Update system to Nand success--------------;led all off;"\
+-
+-
+-#define CONFIG_BOOTCOMMAND \
+- " if test $bootdev = MMC; then " \
+- "mmc dev ${mmcdev}; mmc rescan;"\
+- "echo SD/MMC found on device ${mmcdev};" \
+- "if run loadbootenv; then " \
+- "echo Loaded environment from ${bootenv};" \
+- "run importbootenv;" \
+- "fi;" \
+- "if test -n $uenvcmd; then " \
+- "echo Running uenvcmd ...;" \
+- "run uenvcmd;" \
+- "fi;" \
+- "if run loaduimagefat; then " \
+- "run mmcboot;" \
+- "elif run loaduimage; then " \
+- "run mmcboot;" \
+- "else " \
+- "echo Could not find ${bootfile} ;" \
+- "fi;" \
+- "else " \
+- "run nandboot;" \
+- "fi;" \
+-
+-#else
+-#define CONFIG_BOOTARGS "console=ttyO0,115200n8 earlyprintk ubi.mtd=7,2048 root=ubi0:rootfs rootfstype=ubifs init=/init androidboot.console=ttyO0"
+-#define CONFIG_BOOTCOMMAND "nandecc hw 2;nand read.i 80007fc0 280000 400000;bootm 80007fc0"
+-#endif
++ "screentype=C\0" \
++ "screensize=800x480-7\0" \
++ "confaddr=set spladdr 0x0; set ubootaddr 0x80000; set envaddr 0xc0000; set envsize 0x40000; " \
++ "set kernaddr 0x100000; set kernsize 0x500000; set rootaddr 0x600000; set rootsize 0x9600000 \0" \
++ "confimgs=set spl 'MLO'; set uboot 'u-boot.img'; set kernel 'uImage'; set rootfs 'ubifs.img' \0" \
++ "conf=run confaddr; run confimgs; set filesize 0x20000; \0" \
++ "bbl=run conf; nand erase 0 100000; tftp ${loadaddr} ${spl}; nandecc hw 2; nand write.i ${loadaddr} ${spladdr} ${filesize}; " \
++ "tftp ${uboot}; nandecc hw 2;nand write.i ${loadaddr} ${ubootaddr} ${filesize}\0" \
++ "benv=run confaddr; nandecc hw 0; nand erase ${envaddr} ${envsize}; save\0" \
++ "bkr=run conf; tftp ${loadaddr} ${kernel}; nand erase ${kernaddr} ${kernsize}; "\
++ "nandecc hw 2; nand write.i ${loadaddr} ${kernaddr} ${filesize}\0" \
++ "bfs=run conf; tftp ${loadaddr} ${rootfs}; nand erase ${rootaddr} ${rootsize}; "\
++ "nandecc hw 2; nand write.i ${loadaddr} ${rootaddr} ${filesize}\0" \
++ "bsys=nand scrub.chip; run conf; run bbl; run bkr; run bfs; reset\0"
+
++
+ #define CONFIG_MISC_INIT_R
+ #define CONFIG_SYS_AUTOLOAD "yes"
+ #define CONFIG_CMD_CACHE
+@@ -412,7 +295,7 @@
+ #define CONFIG_SYS_MONITOR_LEN (256 << 10) /* Reserve 2 sectors */
+ #define CONFIG_SYS_FLASH_BASE PISMO1_NAND_BASE
+ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE
+-#define MNAND_ENV_OFFSET 0x260000 /* environment starts here */
++#define MNAND_ENV_OFFSET 0xC0000 /* environment starts here */
+ #define CONFIG_SYS_ENV_SECT_SIZE (128 << 10) /* 128 KiB */
+ #define CONFIG_ENV_OFFSET MNAND_ENV_OFFSET
+ #define CONFIG_ENV_ADDR MNAND_ENV_OFFSET
diff -Nuar u-boot-2011.09/Makefile u-boot-2011.09-ok335x/Makefile
--- u-boot-2011.09/Makefile 2013-11-20 14:14:16.000000000 +0800
-+++ u-boot-2011.09-ok335x/Makefile 2019-07-29 13:39:47.514120392 +0800
++++ u-boot-2011.09-ok335x/Makefile 2019-08-01 15:09:30.547195733 +0800
@@ -155,6 +155,8 @@
# load ARCH, BOARD, and CPU configuration
include $(obj)include/config.mk
--
Gitblit v1.9.1