Patch for generation of u-boot of the OrangePI 2

--- lichee/brandy/u-boot-2011.09/Makefile.orig
+++ lichee/brandy/u-boot-2011.09/Makefile
@@ -160,7 +160,9 @@
 
 # set default to nothing for native builds
 ifeq ($(HOSTARCH),$(ARCH))
-CROSS_COMPILE ?= arm-linux-gnueabi-
+#CROSS_COMPILE ?= arm-linux-gnueabi-
+CROSS_COMPILE ?= arm-linux-gnueabihf-
+USE_PRIVATE_LIBGCC="../gcc-linaro/lib/gcc/arm-linux-gnueabi/4.6.3/"
 endif
 
 # load other configuration
--- lichee/brandy/u-boot-2011.09/drivers/video_sunxi/sunxi_v3/de/lowlevel_sun8iw7/de_wb.c.orig
+++ lichee/brandy/u-boot-2011.09/drivers/video_sunxi/sunxi_v3/de/lowlevel_sun8iw7/de_wb.c
@@ -272,20 +272,22 @@
 		wb_dev[sel]->bypass.dwval |= 0x00000001;
 	}
 	//Coarse scaling
+	cs_out_w0 = out_window_w << 1;
+	cs_out_h0 = out_window_h << 1;
 	if((crop_w > (out_window_w<<1))&&(crop_h > (out_window_h<<1)))
 	{
 		wb_dev[sel]->bypass.dwval |= 0x00000002;
 		wb_dev[sel]->cs_horz.dwval = crop_w |(out_window_w<<17);
 		wb_dev[sel]->cs_vert.dwval = crop_h |(out_window_h<<17);
-		cs_out_w0 = out_window_w<<1;
-		cs_out_h0 = out_window_h<<1;
+//		cs_out_w0 = out_window_w<<1;
+//		cs_out_h0 = out_window_h<<1;
 	}
 	if((crop_w > (out_window_w<<1))&&(crop_h <= (out_window_h<<1)))
 	{
 		wb_dev[sel]->bypass.dwval |= 0x00000002;
 		wb_dev[sel]->cs_horz.dwval = crop_w |(out_window_w<<17);
 		wb_dev[sel]->cs_vert.dwval = 0;
-		cs_out_w0 = out_window_w<<1;
+//		cs_out_w0 = out_window_w<<1;
 		cs_out_h0 = crop_h;
 	}
 	if((crop_w <= (out_window_w<<1))&&(crop_h > (out_window_h<<1)))
@@ -293,7 +295,7 @@
 		wb_dev[sel]->bypass.dwval |= 0x00000002;
 		wb_dev[sel]->cs_horz.dwval = 0;
 		wb_dev[sel]->cs_vert.dwval = crop_h |(out_window_h<<17);
-		cs_out_w0 = crop_w;
+//		cs_out_w0 = crop_w;
 		cs_out_h0 = out_window_h<<1;
 	}
 	if((crop_w <= (out_window_w<<1))&&(crop_h <= (out_window_h<<1)))
--- lichee/brandy/u-boot-2011.09/include/configs/sun8iw7p1.h.orig
+++ lichee/brandy/u-boot-2011.09/include/configs/sun8iw7p1.h
@@ -77,8 +77,8 @@
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
 #define CONFIG_NR_DRAM_BANKS		1
-#define PHYS_SDRAM_1				CONFIG_SYS_SDRAM_BASE	/* SDRAM Bank #1 */
-#define PHYS_SDRAM_1_SIZE			(512 << 20)				/* 0x20000000, 512 MB Bank #1 */
+#define PHYS_SDRAM_1			CONFIG_SYS_SDRAM_BASE	/* SDRAM Bank #1 */
+#define PHYS_SDRAM_1_SIZE		(512 << 20)		/* 0x20000000, 512 MB Bank #1 */
 
 #define CONFIG_NONCACHE_MEMORY
 #define CONFIG_NONCACHE_MEMORY_SIZE (16 * 1024 * 1024)
@@ -317,20 +317,32 @@
 #define CONFIG_CMD_SAVEENV
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
-	"bootdelay=3\0" \
-	"bootcmd=run setargs_nand boot_normal\0" \
+	"scriptaddr=0x44000000\0" \
+	"loadbootenv=" \
+		"fatload mmc 0:1 $scriptaddr uEnv.txt\0" \
+	"loaduenv=if run loadbootenv; then " \
+		"env import -t ${scriptaddr} ${filesize};" \
+		"fi\0" \
+	"bootdelay=2\0" \
+	"bootcmd=run setargs_mmc loaduenv boot_normal\0" \
 	"console=ttyS0,115200\0" \
 	"nand_root=/dev/nandd\0" \
-	"mmc_root=/dev/mmcblk0p7\0" \
+	"mmc_root=/dev/mmcblk0p2\0" \
 	"init=/init\0" \
 	"loglevel=8\0" \
 	"setargs_nand=setenv bootargs console=${console} root=${nand_root}" \
 	"init=${init} loglevel=${loglevel} partitions=${partitions}\0" \
 	"setargs_mmc=setenv bootargs console=${console} root=${mmc_root}" \
 	"init=${init} loglevel=${loglevel} partitions=${partitions}\0" \
-	"boot_normal=sunxi_flash read 40007800 boot;boota 40007800\0" \
+	"boot_normal=fatload mmc 0:1 0x43000000 script.bin;"\
+		"fatload mmc 0:1 40007800 uimage;"\
+		"bootm 40007800\0" \
 	"boot_recovery=sunxi_flash read 40007800 recovery;boota 40007800\0" \
 	"boot_fastboot=fastboot\0"
+//jfm changes
+// no 'echo'
+//		"echo Loaded environment from uEnv.txt;"
+//		"echo bootargs ${bootargs};"
 
 #define CONFIG_SUNXI_SPRITE_ENV_SETTINGS	\
 	"bootdelay=0\0" \
--- lichee/brandy/u-boot-2011.09/usb_sunxi/usb_burn.c.orig
+++ lichee/brandy/u-boot-2011.09/usb_sunxi/usb_burn.c
@@ -1076,7 +1076,11 @@
 						case 1:				//小机端接收数据
 						{
 							//pburn_flash_sectors  = *(int *)(cbw->CBWCDB + 8);
-							pburn_flash_start    = *(int *)(cbw->CBWCDB + 4);
+//							pburn_flash_start    = *(int *)(cbw->CBWCDB + 4);
+							pburn_flash_start = cbw->CBWCDB[4] +
+								(cbw->CBWCDB[5] << 8) +
+								(cbw->CBWCDB[6] << 16) +
+								(cbw->CBWCDB[7] << 24);
 
 							trans_data.recv_size = cbw->dCBWDataTransferLength;
 							trans_data.act_recv_buffer = (uint)trans_data.base_recv_buffer;
@@ -1093,8 +1097,16 @@
 						{
 							uint start, sectors;
 
-							start   = *(int *)(cbw->CBWCDB + 4);		//读数据的偏移量
-							sectors = *(int *)(cbw->CBWCDB + 8);		//扇区数;
+//							start   = *((int *)(cbw->CBWCDB + 4));		//读数据的偏移量
+							start = cbw->CBWCDB[4] +
+								(cbw->CBWCDB[5] << 8) +
+								(cbw->CBWCDB[6] << 16) +
+								(cbw->CBWCDB[7] << 24);
+//							sectors = *((int *)(cbw->CBWCDB + 8));		//扇区数;
+							sectors = cbw->CBWCDB[8] +
+								(cbw->CBWCDB[9] << 8) +
+								(cbw->CBWCDB[10] << 16) +
+								(cbw->CBWCDB[11] << 24);
 
 							printf("start=%d, sectors=%d\n", start, sectors);
 
