View Single Post
Old 10-20-2012, 10:49 AM   #735
eureka
but forgot what it's like
eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.eureka ought to be getting tired of karma fortunes by now.
 
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
Quote:
Originally Posted by eureka View Post
(Patch to original U-Boot source will be provided soon, if it really will work; just let me day or two to tidy up that mess of impulsive edits.)
Quote:
Originally Posted by geekmaster View Post
It appears that eureka's standalone fastboot actually did work, and adi23 is close to debricking his "erased mmc" K5 (after he flashes main with dd instead of fastboot).
OK, as it works and diff of changes isn't so big as I've imagined it, I post diff [to unpacked uboot_2009.08.tar.gz from Kindle_src_5.1.2_1679530004.tar.gz] as promised (I didn't clean it, though).

Version 2 (current version, it's sufficient to apply it only):
Spoiler:
PHP Code:
diff -ur uboot_original/board/freescale/mx50_arm2/mx50_arm2.c uboot_fastboot/board/freescale/mx50_arm2/mx50_arm2.c
--- uboot_original/board/freescale/mx50_arm2/mx50_arm2.c    2012-03-14 17:14:22.000000000 +0000
+++ uboot_fastboot/board/freescale/mx50_arm2/mx50_arm2.c    2012-10-19 18:01:50.000000000 +0000
@@ -601,+601,@@
     
gd->bd->bi_boot_params PHYS_SDRAM_1 0x100;
 
     
/* iomux for uart */
-    setup_uart();
+    
/* setup_uart(); */
 
 #ifdef CONFIG_MXC_FEC
     /* iomux for fec */
diff -ur uboot_original/board/imx50_yoshi/config.mk uboot_fastboot/board/imx50_yoshi/config.mk
--- uboot_original/board/imx50_yoshi/config.mk    2010-11-30 23:30:43.000000000 +0000
+++ uboot_fastboot/board/imx50_yoshi/config.mk    2012-10-20 08:23:07.000000000 +0000
@@ -1,+1,@@
 
ifeq ($(TYPE),prod)
 
LDSCRIPT := $(SRCTREE)/board/$(VENDOR)/$(BOARD)/u-boot.lds
 
-TEXT_BASE 0xF8007000
+TEXT_BASE 0xF8006000
 
else
 
LDSCRIPT := $(SRCTREE)/board/$(VENDOR)/$(BOARD)/bist.lds
 
diff 
-ur uboot_original/board/imx50_yoshi/imx50_yoshi.c uboot_fastboot/board/imx50_yoshi/imx50_yoshi.c
--- uboot_original/board/imx50_yoshi/imx50_yoshi.c    2012-03-13 23:53:41.000000000 +0000
+++ uboot_fastboot/board/imx50_yoshi/imx50_yoshi.c    2013-12-14 15:14:34.000000000 +0000
@@ -64,+64,@@
 
#include <pmic.h>
 #endif
 
+#include <usb/fastboot.h>
+
 
DECLARE_GLOBAL_DATA_PTR;
 
 
unsigned int g_uart_addr UART1_BASE_ADDR;
@@ -
884,+886,@@
     return 
0;
 }
 
+
#if 0
 
inline int check_boot_mode(void
 {
     
char boot_mode[20];
@@ -
948,+951,@@
 
     return 
0;
 }
+
#endif
 
 
void board_power_off(void
 {
@@ -
1057,+1061,@@
 
#endif    //CONFIG_PMIC
 
     /* figure out which partition to boot */
-    check_boot_mode();
+    
//check_boot_mode();
+  fastboot_enable(CONFIG_MMC_BOOTFLASHFASTBOOT_USE_DEFAULT);
 
     return 
0;
 }
diff -ur uboot_original/common/cmd_bootm.c uboot_fastboot/common/cmd_bootm.c
--- uboot_original/common/cmd_bootm.c    2012-03-14 17:14:22.000000000 +0000
+++ uboot_fastboot/common/cmd_bootm.c    2013-12-14 15:51:17.000000000 +0000
@@ -102,+102,@@
 
typedef int boot_os_fn (int flagint argcchar *argv[],
             
bootm_headers_t *images); /* pointers to os/initrd/fdt */
 
-#define CONFIG_BOOTM_LINUX 1
+//#define CONFIG_BOOTM_LINUX 1
 //#define CONFIG_BOOTM_NETBSD 1
 //#define CONFIG_BOOTM_RTEMS 1
 
@@ -967,+967,@@
     return (
void *)img_addr;
 }
 
+
#if 0
 
U_BOOT_CMD(
     
bootm,    CONFIG_SYS_MAXARGS,    1,    do_bootm,
     
"boot application image from memory",
@@ -
1004,+1005,@@
     
"\tprep    - OS specific prep before relocation or go\n"
     "\tgo      - start OS"
 
);
+
#endif
 
 /*******************************************************************/
 /* bootd - boot default image */
diff -ur uboot_original/common/cmd_gadget.c uboot_fastboot/common/cmd_gadget.c
--- uboot_original/common/cmd_gadget.c    2012-03-14 17:14:22.000000000 +0000
+++ uboot_fastboot/common/cmd_gadget.c    2013-12-14 16:02:22.000000000 +0000
@@ -25,+25,@@
 
#include <common.h>
 #include <command.h>
 
+#if 0
 #ifdef CONFIG_GADGET_FASTBOOT
 #include <usb/fastboot.h>
 
@@ -52,+53,@@
     
"Fastboot",
     
"fastboot");
 
#endif
+#endif
 
 #ifdef CONFIG_GADGET_FILE_STORAGE
 #include <usb/file_storage.h>
diff -ur uboot_original/common/cmd_nvedit.c uboot_fastboot/common/cmd_nvedit.c
--- uboot_original/common/cmd_nvedit.c    2010-07-13 16:06:35.000000000 +0000
+++ uboot_fastboot/common/cmd_nvedit.c    2013-12-14 16:23:35.000000000 +0000
@@ -172,+172,@@
 
 
int _do_setenv (int flagint argcchar *argv[])
 {
+
#if 0
     
int   ilenoldval;
     
int   console = -1;
     
uchar *env, *nxt NULL;
@@ -
395,15 +396,18 @@
 
#endif    /* CONFIG_AMIGAONEG3SE */
 
     
return 0;
+
#endif
 
}
 
 
int setenv (char *varnamechar *varvalue)
 {
+
#if 0
     
char *argv[4] = { "setenv"varnamevarvalueNULL };
     if (
varvalue == NULL)
         return 
_do_setenv (02argv);
     else
         return 
_do_setenv (03argv);
+
#endif
 
}
 
 
#ifdef CONFIG_HAS_UID
@@ -416,12 +420,14 @@
 
 
int do_setenv (cmd_tbl_t *cmdtpint flagint argcchar *argv[])
 {
+
#if 0
     
if (argc 2) {
         
cmd_usage(cmdtp);
         return 
1;
     }
 
     return 
_do_setenv (flagargcargv);
+
#endif
 
}
 
 
/************************************************************************
@@ -596,6 +602,7 @@
 
 /**************************************************/
 
+#if 0
 
U_BOOT_CMD(
     
printenvCONFIG_SYS_MAXARGS1,    do_printenv,
     
"print environment variables",
@@ -
639,+646,@@
     
"    - run the commands in the environment variable(s) 'var'"
 
);
 
#endif
+#endif
diff -ur uboot_original/common/main.c uboot_fastboot/common/main.c
--- uboot_original/common/main.c    2012-03-14 17:14:22.000000000 +0000
+++ uboot_fastboot/common/main.c    2013-12-14 16:21:02.000000000 +0000
@@ -273,+273,@@
 
 
void main_loop (void)
 {
+
#if 0
 #ifndef CONFIG_SYS_HUSH_PARSER
     
static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, };
     
int len;
@@ -
512,+513,@@
         }
     }
 
#endif /*CONFIG_SYS_HUSH_PARSER*/
+#endif
 
}
 
 
#ifdef CONFIG_BOOT_RETRY_TIME
@@ -973,+975,@@
 
 
int readline_into_buffer (const char *const promptchar buffer)
 {
+
#if 0
     
char *buffer;
 
#ifdef CONFIG_CMDLINE_EDITING
     
unsigned int len=MAX_CMDBUF_SIZE;
@@ -
1096,+1099,@@
 
#ifdef CONFIG_CMDLINE_EDITING
     
}
 
#endif
+#endif
 
}
 
 
/****************************************************************************/
@@ -1311,+1315,@@
 
 
int run_command (const char *cmdint flag)
 {
+
#if 0
     
cmd_tbl_t *cmdtp;
     
char cmdbuf[CONFIG_SYS_CBSIZE];    /* working copy of cmd        */
     
char *token;            /* start of token in cmdbuf    */
@@ -1432,+1437,@@
     }
 
     return 
rc rc repeatable;
+
#endif
 
}
 
 
/****************************************************************************/
diff -ur uboot_original/drivers/usb/gadget/fastboot.c uboot_fastboot/drivers/usb/gadget/fastboot.c
--- uboot_original/drivers/usb/gadget/fastboot.c    2012-03-14 17:14:22.000000000 +0000
+++ uboot_fastboot/drivers/usb/gadget/fastboot.c    2012-10-19 17:41:45.000000000 +0000
@@ -630,+630,@@
 
extern void board_reset(void);
 
extern void board_power_off(void);
 
extern unsigned int get_dram_size(void);
-
extern int mmc_crc32_test (uint partuint startint sizeuint crc);
+
/*extern int mmc_crc32_test (uint part, uint start, int size, uint crc);*/
 
extern int do_pass (cmd_tbl_t *cmdtpint flagint argcchar *argv[]);
 
extern int do_fail (cmd_tbl_t *cmdtpint flagint argcchar *argv[]);
 
@@ -
1030,10 +1030,10 @@
         
src = (unsigned char *) strtok(NULL" \0"); // get crc
         
crc = (uint)simple_strtoul((char *)srcNULL16);
 
-        if (
mmc_crc32_test(part_indexstartsizecrc)) {
+        
/*if (mmc_crc32_test(part_index, start, size, crc)) {
             fastboot_send_reply("FAILcrc failure");
             goto out;
-        }
+        }*/
 
         
fastboot_send_reply("OKAY");
     }
diff -ur uboot_original/include/configs/imx50_yoshi.h uboot_fastboot/include/configs/imx50_yoshi.h
--- uboot_original/include/configs/imx50_yoshi.h    2012-03-14 17:14:23.000000000 +0000
+++ uboot_fastboot/include/configs/imx50_yoshi.h    2013-12-14 15:25:11.000000000 +0000
@@ -41,+41,@@
 
#define CONFIG_SYS_AXIA_PODF    0
 #define CONFIG_SYS_AXIB_PODF    1
 
-#define CONFIG_DISPLAY_CPUINFO
-#define CONFIG_DISPLAY_BOARDINFO
+//#define CONFIG_DISPLAY_CPUINFO
+//#define CONFIG_DISPLAY_BOARDINFO
 
 #define CONFIG_SYS_64BIT_VSPRINTF
 
@@ -87,+87,18 @@
 
#define CONFIG_MX50_GPIO    1
 
 /*
+ * SPI Configs
+ */
+#define CONFIG_IMX_SPI
+#define CONFIG_IMX_CSPI
+#define CONFIG_IMX_ECSPI
+#define MAX_SPI_BYTES        (8 * 4)
+#define CONFIG_IMX_SPI_PMIC_BUS 3
+#define CONFIG_IMX_SPI_PMIC_CS    0
+#define CONFIG_PMIC        1
+#define CONFIG_PMIC_13892    1
+
+
/*
  * MMC Configs
  */
 #define CONFIG_MMC            1
@@ -107,+119,23 @@
 
#define CONFIG_BOOT_PARTITION_ACCESS
 #define CONFIG_BOOT_FROM_PARTITION    1
 
+#define CONFIG_MMC_MAX_TRANSFER_SIZE    (0xFFFF * 512)
+/*
+ * USB Configs
+ */
+#define CONFIG_USB_DEVICE        1
+#define CONFIG_DRIVER_FSLUSB        1
+#define CONFIG_GADGET_FASTBOOT        1
+
+
#define CONFIG_USBD_MANUFACTURER "Amazon"
+#define CONFIG_USBD_PRODUCT_NAME "Kindle"
+
+
#define CONFIG_USBD_VENDORID            0x1949
+#define CONFIG_USBD_PRODUCTID_FASTBOOT        0xd0d0
+#define CONFIG_FASTBOOT_MAX_DOWNLOAD_LEN    ((get_dram_size()) - (2*1024*1024) - (CONFIG_FASTBOOT_TEMP_BUFFER - CONFIG_SYS_SDRAM_BASE))
+#define CONFIG_FASTBOOT_TEMP_BUFFER        0x7A000000
+//#define CONFIG_CMD_GADGET 1
+
 
#define CONFIG_BOOT_HALT_VOLTAGE    3400    /* 3.4V */
 #define CONFIG_BOOT_CONTINUE_VOLTAGE    3600    /* 3.6V */    
 #define CONFIG_BOOT_AUTOCHG_VOLTAGE    3800    /* 3.8V */    
@@ -121,15 +150,15 @@
  * 
Command definition
  
***********************************************************/
 
-
#define CONFIG_CMD_BOOTD    /* bootd            */
-#define CONFIG_CMD_RUN        /* run command in env variable    */
-#define CONFIG_CMD_LOG
+//#define CONFIG_CMD_BOOTD    /* bootd            */
+//#define CONFIG_CMD_RUN        /* run command in env variable    */
+//#define CONFIG_CMD_LOG
 
 /* Lab 126 cmds */
-#define CONFIG_CMD_BIST        1
-#define CONFIG_CMD_PMIC        1
+//#define CONFIG_CMD_BIST        1
+//#define CONFIG_CMD_PMIC        1
 #define CONFIG_CMD_IDME        1
-#define CONFIG_CMD_HALT        1
+//#define CONFIG_CMD_HALT        1
 
 #define CONFIG_IDME_UPDATE        1
 #define CONFIG_IDME_UPDATE_ADDR        0x3f000
@@ -154,+183,@@
 
#endif
 
 #define CONFIG_LOADADDR        0x70800000    /* loadaddr env var */
-#define CONFIG_RD_LOADADDR    (CONFIG_LOADADDR + 0x300000)
+/*#define CONFIG_RD_LOADADDR    (CONFIG_LOADADDR + 0x300000)
 #define CONFIG_BISTADDR        0x79800000
 
 #define CONFIG_BISTCMD_LOCATION (CONFIG_BISTADDR - 0x80000)
@@ -168,7 +197,7 @@
     "bootargs_diags=setenv bootargs consoleblank=0 rootwait ro ip=off root=/dev/mmcblk0p2 quiet eink=fslepdc\0" \
     "bootcmd_diags=run bootargs_diags ; bootm " MK_STR(CONFIG_MMC_BOOTDIAGS_ADDR) "\0" \
     "bootcmd_factory=bist halt\0" \
-    "bootcmd_fastboot=bist fastboot\0"
+    "bootcmd_fastboot=bist fastboot\0"*/
 
 /*
  * Miscellaneous configurable options
@@ -190,7 +219,7 @@
 #define CONFIG_WDOG_PRINTK_SIZE        (4096 * 2)
 #define CONFIG_SYS_MEMTEST_END      (PHYS_SDRAM_1 + get_dram_size() - 1 - CONFIG_WDOG_PRINTK_SIZE)
 
-#define CONFIG_LOGBUFFER
+//#define CONFIG_LOGBUFFER
 
 #define CONFIG_POST         (CONFIG_SYS_POST_MEMORY | \
                              CONFIG_SYS_POST_FAIL)
@@ -201,7 +230,7 @@
 
 #define CONFIG_SYS_HZ                1000
 
-#define CONFIG_CMDLINE_EDITING    1
+//#define CONFIG_CMDLINE_EDITING    1
 
 /*-----------------------------------------------------------------------
  * Physical Memory Map 

Original (old) version:
Spoiler:
This (initial) version didn't contain code required to reboot whole board, so fastboot reboot command didn't fully work.
PHP Code:
diff -ur uboot/board/imx50_yoshi/config.mk uboot_fastboot/board/imx50_yoshi/config.mk
--- uboot/board/imx50_yoshi/config.mk    2010-11-30 23:30:43.000000000 +0000
+++ uboot_fastboot/board/imx50_yoshi/config.mk    2012-10-20 08:23:07.000000000 +0000
@@ -1,+1,@@
 
ifeq ($(TYPE),prod)
 
LDSCRIPT := $(SRCTREE)/board/$(VENDOR)/$(BOARD)/u-boot.lds
 
-TEXT_BASE 0xF8007000
+TEXT_BASE 0xF8006000
 
else
 
LDSCRIPT := $(SRCTREE)/board/$(VENDOR)/$(BOARD)/bist.lds
 
diff 
-ur uboot/board/imx50_yoshi/imx50_yoshi.c uboot_fastboot/board/imx50_yoshi/imx50_yoshi.c
--- uboot/board/imx50_yoshi/imx50_yoshi.c    2012-03-13 23:53:41.000000000 +0000
+++ uboot_fastboot/board/imx50_yoshi/imx50_yoshi.c    2012-10-19 18:42:52.000000000 +0000
@@ -889,+889,10 @@
     
char boot_mode[20];
     
char boot_cmd[20];
 
+    
setenv("bootcmd""fastboot");
+
+    return 
0;
+
 
#ifdef CONFIG_BIST
     
setenv("bootdelay""-1");
 
#endif
diff -ur uboot/common/cmd_bootm.c uboot_fastboot/common/cmd_bootm.c
--- uboot/common/cmd_bootm.c    2012-03-14 17:14:22.000000000 +0000
+++ uboot_fastboot/common/cmd_bootm.c    2012-10-19 20:24:16.000000000 +0000
@@ -102,+102,@@
 
typedef int boot_os_fn (int flagint argcchar *argv[],
             
bootm_headers_t *images); /* pointers to os/initrd/fdt */
 
-#define CONFIG_BOOTM_LINUX 1
+//#define CONFIG_BOOTM_LINUX 1
 //#define CONFIG_BOOTM_NETBSD 1
 //#define CONFIG_BOOTM_RTEMS 1
 
diff -ur uboot/drivers/usb/gadget/fastboot.c uboot_fastboot/drivers/usb/gadget/fastboot.c
--- uboot/drivers/usb/gadget/fastboot.c    2012-03-14 17:14:22.000000000 +0000
+++ uboot_fastboot/drivers/usb/gadget/fastboot.c    2012-10-19 17:41:45.000000000 +0000
@@ -630,+630,@@
 
extern void board_reset(void);
 
extern void board_power_off(void);
 
extern unsigned int get_dram_size(void);
-
extern int mmc_crc32_test (uint partuint startint sizeuint crc);
+
/*extern int mmc_crc32_test (uint part, uint start, int size, uint crc);*/
 
extern int do_pass (cmd_tbl_t *cmdtpint flagint argcchar *argv[]);
 
extern int do_fail (cmd_tbl_t *cmdtpint flagint argcchar *argv[]);
 
@@ -
1030,10 +1030,10 @@
         
src = (unsigned char *) strtok(NULL" \0"); // get crc
         
crc = (uint)simple_strtoul((char *)srcNULL16);
 
-        if (
mmc_crc32_test(part_indexstartsizecrc)) {
+        
/*if (mmc_crc32_test(part_index, start, size, crc)) {
             fastboot_send_reply("FAILcrc failure");
             goto out;
-        }
+        }*/
 
         
fastboot_send_reply("OKAY");
     }
diff -ur uboot/include/configs/imx50_yoshi.h uboot_fastboot/include/configs/imx50_yoshi.h
--- uboot/include/configs/imx50_yoshi.h    2012-03-14 17:14:23.000000000 +0000
+++ uboot_fastboot/include/configs/imx50_yoshi.h    2012-10-20 14:39:38.000000000 +0000
@@ -41,+41,@@
 
#define CONFIG_SYS_AXIA_PODF    0
 #define CONFIG_SYS_AXIB_PODF    1
 
-#define CONFIG_DISPLAY_CPUINFO
-#define CONFIG_DISPLAY_BOARDINFO
+//#define CONFIG_DISPLAY_CPUINFO
+//#define CONFIG_DISPLAY_BOARDINFO
 
 #define CONFIG_SYS_64BIT_VSPRINTF
 
@@ -107,+107,23 @@
 
#define CONFIG_BOOT_PARTITION_ACCESS
 #define CONFIG_BOOT_FROM_PARTITION    1
 
+#define CONFIG_MMC_MAX_TRANSFER_SIZE    (0xFFFF * 512)
+/*
+ * USB Configs
+ */
+#define CONFIG_USB_DEVICE        1
+#define CONFIG_DRIVER_FSLUSB        1
+#define CONFIG_GADGET_FASTBOOT        1
+
+
#define CONFIG_USBD_MANUFACTURER "Amazon"
+#define CONFIG_USBD_PRODUCT_NAME "Kindle"
+
+
#define CONFIG_USBD_VENDORID            0x1949
+#define CONFIG_USBD_PRODUCTID_FASTBOOT        0xd0d0
+#define CONFIG_FASTBOOT_MAX_DOWNLOAD_LEN    ((get_dram_size()) - (2*1024*1024) - (CONFIG_FASTBOOT_TEMP_BUFFER - CONFIG_SYS_SDRAM_BASE))
+#define CONFIG_FASTBOOT_TEMP_BUFFER        0x7A000000
+#define CONFIG_CMD_GADGET 1
+
 
#define CONFIG_BOOT_HALT_VOLTAGE    3400    /* 3.4V */
 #define CONFIG_BOOT_CONTINUE_VOLTAGE    3600    /* 3.6V */    
 #define CONFIG_BOOT_AUTOCHG_VOLTAGE    3800    /* 3.8V */    
@@ -121,15 +138,15 @@
  * 
Command definition
  
***********************************************************/
 
-
#define CONFIG_CMD_BOOTD    /* bootd            */
-#define CONFIG_CMD_RUN        /* run command in env variable    */
-#define CONFIG_CMD_LOG
+//#define CONFIG_CMD_BOOTD    /* bootd            */
+//#define CONFIG_CMD_RUN        /* run command in env variable    */
+//#define CONFIG_CMD_LOG
 
 /* Lab 126 cmds */
-#define CONFIG_CMD_BIST        1
-#define CONFIG_CMD_PMIC        1
+//#define CONFIG_CMD_BIST        1
+//#define CONFIG_CMD_PMIC        1
 #define CONFIG_CMD_IDME        1
-#define CONFIG_CMD_HALT        1
+//#define CONFIG_CMD_HALT        1
 
 #define CONFIG_IDME_UPDATE        1
 #define CONFIG_IDME_UPDATE_ADDR        0x3f000
@@ -190,+207,@@
 
#define CONFIG_WDOG_PRINTK_SIZE        (4096 * 2)
 #define CONFIG_SYS_MEMTEST_END      (PHYS_SDRAM_1 + get_dram_size() - 1 - CONFIG_WDOG_PRINTK_SIZE)
 
-#define CONFIG_LOGBUFFER
+//#define CONFIG_LOGBUFFER
 
 #define CONFIG_POST         (CONFIG_SYS_POST_MEMORY | \
                              
CONFIG_SYS_POST_FAIL)
@@ -
201,+218,@@
 
 
#define CONFIG_SYS_HZ                1000
 
-#define CONFIG_CMDLINE_EDITING    1
+//#define CONFIG_CMDLINE_EDITING    1
 
 /*-----------------------------------------------------------------------
  * Physical Memory Map 

Last edited by eureka; 12-22-2013 at 12:31 PM. Reason: add second version of diff
eureka is offline   Reply With Quote