mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 06:00:43 +00:00
bootstd: cros: Support a kernel on either partition
ChromiumOS allows a kernel to be on either partition 2 or 4. Add support for scanning both and using the first one we find with a suitable signature. Record the partition which is used. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
de30aa9a2f
commit
4cfe4510f1
1 changed files with 14 additions and 7 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include <bootdev.h>
|
#include <bootdev.h>
|
||||||
#include <bootflow.h>
|
#include <bootflow.h>
|
||||||
#include <bootmeth.h>
|
#include <bootmeth.h>
|
||||||
|
#include <display_options.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <mapmem.h>
|
#include <mapmem.h>
|
||||||
|
@ -133,7 +134,7 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
|
||||||
struct disk_partition info;
|
struct disk_partition info;
|
||||||
const char *uuid = NULL;
|
const char *uuid = NULL;
|
||||||
void *buf, *hdr;
|
void *buf, *hdr;
|
||||||
int ret;
|
int part, ret;
|
||||||
|
|
||||||
log_debug("starting, part=%d\n", bflow->part);
|
log_debug("starting, part=%d\n", bflow->part);
|
||||||
|
|
||||||
|
@ -141,13 +142,19 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
|
||||||
if (bflow->part)
|
if (bflow->part)
|
||||||
return log_msg_ret("max", -ENOENT);
|
return log_msg_ret("max", -ENOENT);
|
||||||
|
|
||||||
/* Check partition 2 */
|
/* Check partition 2 then 4 */
|
||||||
ret = scan_part(bflow->blk, 2, &info, &hdr);
|
part = 2;
|
||||||
if (ret)
|
ret = scan_part(bflow->blk, part, &info, &hdr);
|
||||||
return log_msg_ret("scan", ret);
|
if (ret) {
|
||||||
bflow->part = 2;
|
part = 4;
|
||||||
|
ret = scan_part(bflow->blk, part, &info, &hdr);
|
||||||
|
if (ret)
|
||||||
|
return log_msg_ret("scan", ret);
|
||||||
|
}
|
||||||
|
bflow->part = part;
|
||||||
|
|
||||||
log_info("Header at %lx\n", (ulong)map_to_sysmem(hdr));
|
log_info("Selected parition %d, header at %lx\n", bflow->part,
|
||||||
|
(ulong)map_to_sysmem(hdr));
|
||||||
start = *(u32 *)(hdr + KERN_START);
|
start = *(u32 *)(hdr + KERN_START);
|
||||||
size = ALIGN(*(u32 *)(hdr + KERN_SIZE), desc->blksz);
|
size = ALIGN(*(u32 *)(hdr + KERN_SIZE), desc->blksz);
|
||||||
log_debug("Reading start %lx size %lx\n", start, size);
|
log_debug("Reading start %lx size %lx\n", start, size);
|
||||||
|
|
Loading…
Reference in a new issue