Message ID | 1341860020-11507-3-git-send-email-mikhail.kshevetskiy@gmail.com |
---|---|
State | Changes Requested |
Delegated to: | Tom Rini |
Headers | show |
hi Mikhail, On Mon Jul 09, 2012 at 10:53:40PM +0400, Mikhail Kshevetskiy wrote: > Motivation: > * we have a board with 128 Kb spi flash, so normal u-boot.ais does not > fit on it. > > This patch add support of compressed 2-nd u-boot stage. To create a compressed > ais image its required: > * define CONFIG_SPL_GUNZIP_SUPPORT --- enable compressed ais image supports > * define CONFIG_SPL_GUNZIP_MAX_SIZE --- define a maximum size of compressed > u-boot part > * define CONFIG_SPL_GUNZIP_LOAD_ADDR --- memory address to load compressed > u-boot part (CONFIG_SPL_GUNZIP_LOAD_ADDR region should not overlap with > CONFIG_SYS_TEXT_BASE region) > * use: make u-boot-gzip.ais to get a compressed ais image I don't see any of these macros being defined for any board in your patch series. Which boards are they being used on. Also, i think these defines need to be added to the README. -sughosh
On Wed, 11 Jul 2012 00:19:26 +0530 Sughosh Ganu <urwithsughosh@gmail.com> wrote: > hi Mikhail, > On Mon Jul 09, 2012 at 10:53:40PM +0400, Mikhail Kshevetskiy wrote: > > Motivation: > > * we have a board with 128 Kb spi flash, so normal u-boot.ais does not > > fit on it. > > > > This patch add support of compressed 2-nd u-boot stage. To create a > > compressed ais image its required: > > * define CONFIG_SPL_GUNZIP_SUPPORT --- enable compressed ais image supports > > * define CONFIG_SPL_GUNZIP_MAX_SIZE --- define a maximum size of compressed > > u-boot part > > * define CONFIG_SPL_GUNZIP_LOAD_ADDR --- memory address to load compressed > > u-boot part (CONFIG_SPL_GUNZIP_LOAD_ADDR region should not overlap with > > CONFIG_SYS_TEXT_BASE region) > > * use: make u-boot-gzip.ais to get a compressed ais image > > I don't see any of these macros being defined for any board in your > patch series. Which boards are they being used on. Also, i think these > defines need to be added to the README. Definitely. This modification were created for our omap l138 based board. The board is in early development state, so i think it's not reasonable to add it to u-boot for now. Anyway, I test this changes on da850evm board, so I can resubmit this patch with defconfig modification for da850evm. Mikhail
diff --git a/Makefile b/Makefile index 85e36ec..cf16824 100644 --- a/Makefile +++ b/Makefile @@ -452,6 +452,20 @@ $(obj)u-boot.ais: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin $(obj)u-boot.ais rm $(obj)spl/u-boot-spl{,-pad}.ais +$(obj)u-boot-gzip.ais: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin + $(obj)tools/mkimage -s -n /dev/null -T aisimage \ + -e $(CONFIG_SPL_TEXT_BASE) \ + -d $(obj)spl/u-boot-spl.bin \ + $(obj)spl/u-boot-spl.ais + $(OBJCOPY) ${OBJCFLAGS} -I binary \ + --pad-to=$(CONFIG_SPL_MAX_SIZE) -O binary \ + $(obj)spl/u-boot-spl.ais $(obj)spl/u-boot-spl-pad.ais + cp $(obj)u-boot.bin $(obj)spl/u-boot.bin + gzip $(obj)spl/u-boot.bin + cat $(obj)spl/u-boot-spl-pad.ais $(obj)spl/u-boot.bin.gz > \ + $(obj)u-boot-gzip.ais + rm $(obj)spl/u-boot-spl{,-pad}.ais $(obj)spl/u-boot.bin.gz + $(obj)u-boot.sb: $(obj)u-boot.bin $(obj)spl/u-boot-spl.bin elftosb -zdf imx28 -c $(TOPDIR)/board/$(BOARDDIR)/u-boot.bd \ -o $(obj)u-boot.sb diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c b/arch/arm/cpu/arm926ejs/davinci/spl.c index 50b4bbc..041df5b 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl.c @@ -111,6 +111,7 @@ u32 davinci_boot_device(void){ void board_init_r(gd_t *id, ulong dummy) { + int size; u32 boot_device; void (*uboot)(void) __noreturn; @@ -159,6 +160,12 @@ void board_init_r(gd_t *id, ulong dummy) break; } +#ifdef CONFIG_SPL_GUNZIP_SUPPORT + size = CONFIG_SPL_GUNZIP_MAX_SIZE; + gunzip((void *)CONFIG_SYS_TEXT_BASE, 512 * 1024, + (void *)CONFIG_SPL_GUNZIP_LOAD_ADDR, &size); +#endif + puts("Jump to U-Boot image...\n"); uboot = (void *) CONFIG_SYS_TEXT_BASE; (*uboot)(); diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_mmc.c b/arch/arm/cpu/arm926ejs/davinci/spl_mmc.c index 1a551e9..fa67f1a 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl_mmc.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl_mmc.c @@ -28,7 +28,12 @@ void spl_mmc_load_image(void) ret = mmc->block_dev.block_read(0, CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR, CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS, - (void *) CONFIG_SYS_TEXT_BASE); +#ifndef CONFIG_SPL_GUNZIP_SUPPORT + (void *) CONFIG_SYS_TEXT_BASE +#else + (void *) CONFIG_SPL_GUNZIP_LOAD_ADDR +#endif + ); if (ret < 0) { printf("spl: mmc blk read err - %d\n", ret); hang(); diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_nand.c b/arch/arm/cpu/arm926ejs/davinci/spl_nand.c index bad1e8f..4bf3e6a 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl_nand.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl_nand.c @@ -6,6 +6,11 @@ void spl_nand_load_image(void) nand_init(); nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE, - (void *) CONFIG_SYS_TEXT_BASE); +#ifndef CONFIG_SPL_GUNZIP_SUPPORT + (void *) CONFIG_SYS_TEXT_BASE +#else + (void *) CONFIG_SPL_GUNZIP_LOAD_ADDR +#endif + ); debug("Loaded %d bytes from NAND flash\n", CONFIG_SYS_NAND_U_BOOT_SIZE); } diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c b/arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c index d6fadcd..76d4d51 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c @@ -15,7 +15,12 @@ void spl_spi_flash_load_image(void) ret = spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS, CONFIG_SYS_SPI_U_BOOT_SIZE, - (void *) CONFIG_SYS_TEXT_BASE); +#ifndef CONFIG_SPL_GUNZIP_SUPPORT + (void *) CONFIG_SYS_TEXT_BASE +#else + (void *) CONFIG_SPL_GUNZIP_LOAD_ADDR +#endif + ); if (ret < 0) { printf("spl: spi flash read err - %d\n", ret); hang(); diff --git a/arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c b/arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c index b8c4db1..857436f 100644 --- a/arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c +++ b/arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c @@ -24,7 +24,11 @@ void spl_ymodem_load_image(void) info.mode = xyzModem_ymodem; res = xyzModem_stream_open(&info, &err); if (!res) { +#ifndef CONFIG_SPL_GUNZIP_SUPPORT store_addr = CONFIG_SYS_TEXT_BASE; +#else + store_addr = CONFIG_SPL_GUNZIP_LOAD_ADDR; +#endif while ((res = xyzModem_stream_read( (char *)store_addr, 1024, &err)) > 0) { store_addr += res; diff --git a/lib/Makefile b/lib/Makefile index c60c380..5a259ed 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -58,6 +58,7 @@ endif ifdef CONFIG_SPL_BUILD COBJS-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16.o +COBJS-$(CONFIG_SPL_GUNZIP_SUPPORT) += gunzip.o endif COBJS-y += crc32.o COBJS-y += ctype.o diff --git a/spl/Makefile b/spl/Makefile index ea7d475..d11d8b2 100644 --- a/spl/Makefile +++ b/spl/Makefile @@ -52,6 +52,7 @@ LIBS-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += drivers/mtd/spi/libspi_flash.o LIBS-$(CONFIG_SPL_SPI_SUPPORT) += drivers/spi/libspi.o LIBS-$(CONFIG_SPL_FAT_SUPPORT) += fs/fat/libfat.o LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/libgeneric.o +LIBS-$(CONFIG_SPL_GUNZIP_SUPPORT) += lib/zlib/libz.o LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/libpower.o LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/libnand.o LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/libonenand.o
Motivation: * we have a board with 128 Kb spi flash, so normal u-boot.ais does not fit on it. This patch add support of compressed 2-nd u-boot stage. To create a compressed ais image its required: * define CONFIG_SPL_GUNZIP_SUPPORT --- enable compressed ais image supports * define CONFIG_SPL_GUNZIP_MAX_SIZE --- define a maximum size of compressed u-boot part * define CONFIG_SPL_GUNZIP_LOAD_ADDR --- memory address to load compressed u-boot part (CONFIG_SPL_GUNZIP_LOAD_ADDR region should not overlap with CONFIG_SYS_TEXT_BASE region) * use: make u-boot-gzip.ais to get a compressed ais image Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com> --- Change for v3: * split MMC+SPL+no partition table support bugfix to separate patch series (series 3/3) Change for v2: * fix checkpatch warnings * fix merge conflict with upstream u-boot sources * improve patch description --- Makefile | 14 ++++++++++++++ arch/arm/cpu/arm926ejs/davinci/spl.c | 7 +++++++ arch/arm/cpu/arm926ejs/davinci/spl_mmc.c | 7 ++++++- arch/arm/cpu/arm926ejs/davinci/spl_nand.c | 7 ++++++- arch/arm/cpu/arm926ejs/davinci/spl_spi_flash.c | 7 ++++++- arch/arm/cpu/arm926ejs/davinci/spl_ymodem.c | 4 ++++ lib/Makefile | 1 + spl/Makefile | 1 + 8 files changed, 45 insertions(+), 3 deletions(-)