From: Simon Schwarz <simonschwarzcor@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Linux boot and list loading feature
Date: Mon, 01 Aug 2011 13:20:53 +0200 [thread overview]
Message-ID: <4E368C15.8000007@gmail.com> (raw)
Hi Aneesh,
I am working on the OS booting right now and have a bigger change of
your code in spl.c in mind.
Hope you can say one or two words what you think about it.
THE PROBLEM
For the direct OS boot and in some other situations - env image e.g., I
have to load more than one image in SPL.
This can be done by hardcoding these cases and use #ifdef or ifs to
switch between them. Or I can implement a general image loading with lists.
(This was discussed here:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/102345)
I already implemented the list for NAND - and now start prototyping it
also for MMC. There will be some change to your spl.c-code so I decided
to ask what you think about it.
These are the modifications in the board config:
/* Assemble boot lists */
/* Last image in list is image to boot! */
/* NAND boot lists */
#define CONFIG_SPL_NAND_OS_LOAD {CONFIG_CMD_SAVEBP_NAND_OFS, \
CONFIG_SYS_NAND_SPL_KERNEL_OFFS}
#ifdef CONFIG_NAND_ENV_DST
#ifdef CONFIG_ENV_OFFSET_REDUND
#define CONFIG_SPL_NAND_UBOOT_LOAD {CONFIG_ENV_OFFSET_REDUND, \
CONFIG_ENV_OFFSET, \
CONFIG_SYS_NAND_U_BOOT_OFFS}
#endif
#define CONFIG_SPL_NAND_UBOOT_LOAD {CONFIG_ENV_OFFSET, \
CONFIG_SYS_NAND_U_BOOT_OFFS}
#else
#define CONFIG_SPL_NAND_UBOOT_LOAD {CONFIG_SYS_NAND_U_BOOT_OFFS}
#endif
/* MMC RAW boot lists */
#define CONFIG_SPL_MMCSD_RAW_OS_LOAD {0x0, 0x0} /* XXX: define me */
#define CONFIG_SPL_MMCSD_RAW_UBOOT_LOAD {\
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR}
/* MMC RAW boot lists */
#define CONFIG_SPL_MMCSD_FAT_OS_LOAD {"uImage", "fdt_params.img"}
#define CONFIG_SPL_MMCSD_FAT_UBOOT_LOAD {CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME}
Essentially just putting together the lists for all the different boot
devices/modes.
Your mmc_load_image_raw will then look like this:
static void mmc_load_image_raw(struct mmc *mmc)
{
u32 image_size_sectors, err;
const struct image_header *header;
uint32_t i;
#ifdef CONFIG_SPL_OS_BOOT
uint32_t load_list_os[] = CONFIG_SPL_MMCSD_RAW_OS_LOAD;
#endif
uint32_t load_list_uboot[] = CONFIG_SPL_MMCSD_RAW_UBOOT_LOAD;
uint32_t *load_list = load_list_uboot;
header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
sizeof(struct
image_header));
#ifdef CONFIG_SPL_OS_BOOT
if (!uboot_key())
load_list = load_list_os;
#endif
for(i = 0; i < N_LOAD_LIST_ENTRYS; i++) {
/* read image header to find the image size & load
address */
err = mmc->block_dev.block_read(0, load_list[i], 1,
(void *)header);
if (err <= 0)
goto end;
parse_image_header(header);
/* convert size to sectors - round up */
image_size_sectors = (image_size + MMCSD_SECTOR_SIZE - 1) /
MMCSD_SECTOR_SIZE;
/* Read the header too to avoid extra memcpy */
err = mmc->block_dev.block_read(0,
load_list[i], image_size_sectors,
(void *)image_load_addr);
}
end:
if (err <= 0) {
printf("spl: mmc blk read err - %d\n", err);
hang();
}
}
This is just a protoype - quick, dirty & untested. I would be happy to
hear what you think about the approach.
Regards
Simon
next reply other threads:[~2011-08-01 11:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-01 11:20 Simon Schwarz [this message]
2011-08-01 12:56 ` [U-Boot] Linux boot and list loading feature Aneesh V
2011-08-01 14:13 ` Simon Schwarz
2011-08-02 12:41 ` Aneesh V
2011-08-02 13:03 ` Heiko Schocher
2011-08-02 13:45 ` Wolfgang Denk
2011-08-09 13:45 ` Simon Schwarz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E368C15.8000007@gmail.com \
--to=simonschwarzcor@googlemail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox