u-boot/mlo-ext2.patch
Stephan Kulow 8474a81f96 Accepting request 215532 from Base:System
Disable CONFIG_SPL_OS_BOOT for ti armv7 configs with 
fix_spl_build_for_am335x.patch to reduce size of am335x SPL (forwarded request 215393 from Guillaume_G)

OBS-URL: https://build.opensuse.org/request/show/215532
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/u-boot?expand=0&rev=21
2014-01-29 21:22:37 +00:00

174 lines
5.2 KiB
Diff

diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 2922816..39a94ad 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -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;
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index fc2f226..fc60e98 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -11,6 +11,7 @@
#include <asm/u-boot.h>
#include <mmc.h>
#include <fat.h>
+#include <ext4fs.h>
#include <version.h>
#include <image.h>
@@ -70,6 +71,58 @@ static int mmc_load_image_raw_os(struct mmc *mmc)
#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;
@@ -141,7 +194,9 @@ void spl_mmc_load_image(void)
hang();
}
- boot_mode = spl_boot_mode();
+// 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
diff --git a/fs/Makefile b/fs/Makefile
index 34dc035..a09ada5 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -8,6 +8,7 @@
ifdef CONFIG_SPL_BUILD
obj-$(CONFIG_SPL_FAT_SUPPORT) += fat/
+obj-$(CONFIG_SPL_FAT_SUPPORT) += ext4/
else
obj-y += fs.o
diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index c58bc91..7ecae0c 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -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
@@ -250,7 +251,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} " \
diff --git a/include/configs/omap4_common.h b/include/configs/omap4_common.h
index d099bfd..24b2ceb 100644
--- a/include/configs/omap4_common.h
+++ b/include/configs/omap4_common.h
@@ -104,10 +104,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" \