--- ./common/spl/spl_mmc.c.orig 2013-11-25 10:36:58.994214337 +0100 +++ ./common/spl/spl_mmc.c 2013-11-25 10:53:09.983264655 +0100 @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -70,6 +71,58 @@ static int mmc_load_image_raw_os(struct #endif #ifdef CONFIG_SPL_FAT_SUPPORT +static int mmc_load_image_ext2(struct mmc *mmc, const char *filename) +{ + s32 err; + struct image_header *header; + int filelen; + disk_partition_t part_info = {}; + + header = (struct image_header *)(CONFIG_SYS_TEXT_BASE - + sizeof(struct image_header)); + + if (get_partition_info(&mmc->block_dev, + CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION, &part_info)) { + printf("spl: no partition table found\n"); + goto end; + } + + ext4fs_set_blk_dev(&mmc->block_dev, &part_info); +// err = ext4fs_set_blk_dev(&mmc->block_dev, &part_info); +// if (!err) { +// printf("spl: ext4fs register err - %d\n", err); +// goto end; +// } + + err = ext4fs_mount(0); + if (!err) { + printf("spl: ext4fs mount err - %d\n", err); + goto end; + } + + filelen = err = ext4fs_open(filename); + if (err < 0) { + puts("spl: ext4fs_open failed\n"); + goto end; + } + err = ext4fs_read((u8 *)header, sizeof(struct image_header)); + if (err <= 0) { + puts("spl: ext4fs_read failed\n"); + goto end; + } + + spl_parse_image_header(header); + + err = ext4fs_read((u8 *)spl_image.load_addr, filelen); + +end: + if (err <= 0) { + printf("spl: error reading image %s, err - %d\n", + filename, err); + } + return (err <= 0); +} + static int mmc_load_image_fat(struct mmc *mmc, const char *filename) { int err; @@ -142,6 +195,8 @@ void spl_mmc_load_image(void) } boot_mode = spl_boot_mode(); + boot_mode = MMCSD_MODE_FAT; /* Fix OMAP4 boot */ + if (boot_mode == MMCSD_MODE_RAW) { debug("boot mode - RAW\n"); #ifdef CONFIG_SPL_OS_BOOT @@ -153,19 +208,20 @@ void spl_mmc_load_image(void) } else if (boot_mode == MMCSD_MODE_FAT) { debug("boot mode - FAT\n"); - err = fat_register_device(&mmc->block_dev, - CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION); - if (err) { +// err = fat_register_device(&mmc->block_dev, +// CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION); +// if (err) { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT - printf("spl: fat register err - %d\n", err); +// printf("spl: fat register err - %d\n", err); #endif - hang(); - } +// hang(); +// } #ifdef CONFIG_SPL_OS_BOOT if (spl_start_uboot() || mmc_load_image_fat_os(mmc)) #endif - err = mmc_load_image_fat(mmc, CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME); +// err = mmc_load_image_fat(mmc, CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME); + err = mmc_load_image_ext2(mmc, "u-boot.bin"); /* We use u-boot.bin file on first partition */ #endif } else { #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT --- ./include/configs/omap3_beagle.h.orig 2013-11-21 14:01:46.884722728 +0100 +++ ./include/configs/omap3_beagle.h 2013-11-21 14:05:56.469711684 +0100 @@ -40,6 +40,7 @@ #define CONFIG_OF_LIBFDT #define CONFIG_CMD_BOOTZ +#define CONFIG_SUPPORT_RAW_INITRD /* bootz raw initrd support */ #define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */ #define CONFIG_SETUP_MEMORY_TAGS 1 @@ -249,7 +250,7 @@ "if test $fdtfile = undefined; then " \ "echo WARNING: Could not determine device tree to use; fi; \0" \ "bootenv=uEnv.txt\0" \ - "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \ + "loadbootenv=load mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \ "importbootenv=echo Importing environment from mmc ...; " \ "env import -t $loadaddr $filesize\0" \ "ramargs=setenv bootargs console=${console} " \ --- ./include/configs/omap4_common.h.orig 2013-11-21 14:05:29.066372667 +0100 +++ ./include/configs/omap4_common.h 2013-11-21 14:06:39.260679071 +0100 @@ -111,6 +111,7 @@ #define CONFIG_CMD_FAT /* FAT support */ #define CONFIG_CMD_I2C /* I2C serial bus support */ #define CONFIG_CMD_MMC /* MMC support */ +#define CONFIG_SUPPORT_RAW_INITRD /* bootz raw initrd support */ /* Disabled commands */ #undef CONFIG_CMD_NET @@ -148,10 +149,10 @@ "vram=${vram} " \ "root=${mmcroot} " \ "rootfstype=${mmcrootfstype}\0" \ - "loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr\0" \ + "loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \ "bootscript=echo Running bootscript from mmc${mmcdev} ...; " \ "source ${loadaddr}\0" \ - "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} uEnv.txt\0" \ + "loadbootenv=load mmc ${mmcdev} ${loadaddr} uEnv.txt\0" \ "importbootenv=echo Importing environment from mmc${mmcdev} ...; " \ "env import -t ${loadaddr} ${filesize}\0" \ "loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \ --- ./spl/Makefile.orig 2013-11-21 14:10:09.094607542 +0100 +++ ./spl/Makefile 2013-11-21 14:10:21.476307890 +0100 @@ -86,6 +86,7 @@ LIBS-$(CONFIG_SPL_SERIAL_SUPPORT) += dri 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_FAT_SUPPORT) += fs/ext4/libext4fs.o LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/libgeneric.o LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/libpower.o \ drivers/power/pmic/libpmic.o --- arch/arm/cpu/armv7/omap3/board.c.orig 2013-11-21 15:21:32.962225786 +0100 +++ arch/arm/cpu/armv7/omap3/board.c 2013-11-21 15:22:26.797911840 +0100 @@ -61,6 +61,8 @@ u32 omap3_boot_device = BOOT_DEVICE_NAND /* auto boot mode detection is not possible for OMAP3 - hard code */ u32 spl_boot_mode(void) { + return MMCSD_MODE_FAT; + switch (spl_boot_device()) { case BOOT_DEVICE_MMC2: return MMCSD_MODE_RAW;