Message ID | 4E0C5FE3.10300@denx.de |
---|---|
State | Superseded |
Headers | show |
thanks Heiko! That seems like half of the work :) > - we should define a struct, which contains the 3 values > offset, size, destination, so we can create a "nand_load_list" > which can contain n entries, that could be processed in > a while loop ... so no need for the CONFIG_SYS_BOOT_LINUX > define ;-) I would also add some kind of CRC to check the integrity of the image? Another question is if we not just use the uImage format provided by mkImage. This IMHO should include all this (except the offset) but then we have to read the first NAND-page (or what ever medium) to get these values which presumably means a significant slow-down. But then we can update the image without updating u-boot what i would consider important for non-dev devices. Regards Simon
Dear Simon Schwarz, In message <BANLkTinCM+qWU_D50LJgf6Am=7GgoErh4g@mail.gmail.com> you wrote: > > > - we should define a struct, which contains the 3 values > > offset, size, destination, so we can create a "nand_load_list" > > which can contain n entries, that could be processed in > > a while loop ... so no need for the CONFIG_SYS_BOOT_LINUX > > define ;-) > > I would also add some kind of CRC to check the integrity of the image? If you add this, then please make sure to make it optional. Keep in mind that there are systems where the SPL code has to be really small (like 4 or even 2 KiB). > Another question is if we not just use the uImage format provided by > mkImage. This IMHO should include all this (except the offset) but > then we have to read the first NAND-page (or what ever medium) to get > these values which presumably means a significant slow-down. But then > we can update the image without updating u-boot what i would consider > important for non-dev devices. Reading an uImage and just skipping the 64 byte image header is definitely an option. Please keep the design simple - adding bells and whistles can be done later, if there is room and time for it. Best regards, Wolfgang Denk
diff --git a/include/configs/board_config.h b/include/configs/board_config.h index fed8ac1..6f304f5 100644 --- a/include/configs/board_config.h +++ b/include/configs/board_config.h @@ -342,6 +342,19 @@ was ist das? * and in nand_spl mode cpu setup is * done in board_init_f from c code. */ +#define CONFIG_SYS_BOOT_LINUX +#if defined(CONFIG_SYS_BOOT_LINUX) +#define CONFIG_SYS_NAND_LINUX_OFFS 0x400000 +#define CONFIG_SYS_NAND_LINUX_SIZE 0x240000 +#define CONFIG_SYS_NAND_LINUX_DST 0x80008000 + +#define CONFIG_SYS_NAND_ATAG_OFFS (CONFIG_SYS_NAND_LINUX_OFFS + CONFIG_SYS_NAND_LINUX_SIZE) +#define CONFIG_SYS_NAND_ATAG_SIZE (CONFIG_SYS_NAND_PAGE_SIZE) +#define CONFIG_SYS_NAND_ATAG_DST (0x80000100) + +#define CONFIG_SYS_NAND_SPL_MACHID MACH_TYPE_DAVINCI_DM365_EVM +#endif + /* for UBL header */ diff --git a/nand_spl/nand_boot.c b/nand_spl/nand_boot.c index c0e56e7..f78b39d 100644 --- a/nand_spl/nand_boot.c +++ b/nand_spl/nand_boot.c @@ -242,6 +239,8 @@ static int nand_load(struct mtd_info *mtd, unsigned int offs, nand_read_page(mtd, block, page, dst); dst += CONFIG_SYS_NAND_PAGE_SIZE; page++; + if (uboot_size == CONFIG_SYS_NAND_PAGE_SIZE) + break; } page = 0; @@ -280,6 +279,30 @@ void nand_boot(void) if (nand_chip.select_chip) nand_chip.select_chip(&nand_info, 0); +#if defined(CONFIG_SYS_BOOT_LINUX) + { + __attribute__((noreturn)) void (*kernel_entry)(int zero, int arch, uint params); + + kernel_entry = (void (*)(int, int, uint))CONFIG_SYS_NAND_LINUX_DST; + /* + * Load Linux image from NAND into RAM + */ + puts("load Linux image ...\n"); + ret = nand_load(&nand_info, CONFIG_SYS_NAND_LINUX_OFFS, CONFIG_SYS_NAND_LINUX_SIZE, + (uchar *)CONFIG_SYS_NAND_LINUX_DST); + /* + * Load ATAG image from NAND into RAM + */ + puts("load ATAG image ...\n"); + ret = nand_load(&nand_info, CONFIG_SYS_NAND_ATAG_OFFS, CONFIG_SYS_NAND_ATAG_SIZE, + (uchar *)CONFIG_SYS_NAND_ATAG_DST); + + + puts("booting Linux ....\n"); + (kernel_entry)(0, CONFIG_SYS_NAND_SPL_MACHID, CONFIG_SYS_NAND_ATAG_DST); + } +#else + /* * Load U-Boot image from NAND into RAM */ @@ -304,4 +327,5 @@ void nand_boot(void) */ uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START; (*uboot)(); +#endif }