SHA256
1
0
forked from pool/u-boot
u-boot/mlo-ext2.patch

174 lines
5.5 KiB
Diff
Raw Normal View History

diff --git arch/arm/cpu/armv7/omap3/board.c.orig arch/arm/cpu/armv7/omap3/board.c
index 2922816..39a94ad 100644
--- arch/arm/cpu/armv7/omap3/board.c.orig
+++ 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;
--- ./common/spl/spl_mmc.c.orig 2014-04-14 21:19:24.000000000 +0200
+++ ./common/spl/spl_mmc.c 2014-04-29 10:54:20.844025492 +0200
@@ -92,7 +92,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
@@ -107,9 +109,12 @@ void spl_mmc_load_image(void)
if (spl_start_uboot() || spl_load_image_fat_os(&mmc->block_dev,
CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION))
#endif
- err = spl_load_image_fat(&mmc->block_dev,
+// err = spl_load_image_fat(&mmc->block_dev,
+// CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION,
+// CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
+ err = spl_load_image_ext2(&mmc->block_dev,
CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION,
- CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
+ "u-boot.bin"/*CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME*/); /* We use u-boot.bin file on first partition */
#endif
#ifdef CONFIG_SUPPORT_EMMC_BOOT
} else if (boot_mode == MMCSD_MODE_EMMCBOOT) {
--- ./common/spl/spl_fat.c.orig 2014-04-29 10:45:48.565021128 +0200
+++ ./common/spl/spl_fat.c 2014-04-29 10:54:18.660076999 +0200
@@ -13,6 +13,7 @@
#include <spl.h>
#include <asm/u-boot.h>
#include <fat.h>
+#include <ext4fs.h>
#include <image.h>
static int fat_registered;
@@ -38,6 +39,61 @@ static int spl_register_fat_device(block
return err;
}
+int spl_load_image_ext2(block_dev_desc_t *block_dev,
+ int partition,
+ 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(block_dev,
+ partition, &part_info)) {
+ printf("spl: no partition table found\n");
+ goto end;
+ }
+
+ ext4fs_set_blk_dev(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);
+}
+
+
int spl_load_image_fat(block_dev_desc_t *block_dev,
int partition,
const char *filename)
--- include/spl.h.orig 2014-04-29 10:56:22.351156694 +0200
+++ include/spl.h 2014-04-29 10:56:54.996384973 +0200
@@ -69,6 +69,7 @@ void spl_usb_load_image(void);
void spl_sata_load_image(void);
/* SPL FAT image functions */
+int spl_load_image_ext2(block_dev_desc_t *block_dev, int partition, const char *filename);
int spl_load_image_fat(block_dev_desc_t *block_dev, int partition, const char *filename);
int spl_load_image_fat_os(block_dev_desc_t *block_dev, int partition);
diff --git fs/Makefile.orig fs/Makefile
index 34dc035..a09ada5 100644
--- fs/Makefile.orig
+++ 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 include/configs/omap3_beagle.h.orig include/configs/omap3_beagle.h
index c58bc91..7ecae0c 100644
--- include/configs/omap3_beagle.h.orig
+++ 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 include/configs/ti_omap4_common.h.orig include/configs/ti_omap4_common.h
index d099bfd..24b2ceb 100644
--- include/configs/ti_omap4_common.h.orig
+++ include/configs/ti_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" \