Skip to content

Commit

Permalink
ODROID-COMMON: add the 'ignore' property to not booting media.
Browse files Browse the repository at this point in the history
Change-Id: I8d6386241acd4a4190d3eb8f80c6159e8ce4da81
  • Loading branch information
xiane authored and codewalkerster committed Jan 17, 2019
1 parent d2f0be3 commit fa5dd20
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions common/bootm.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,57 @@ static int get_fdto_totalsize(u32 *tz)
}
#endif

#if defined(CONFIG_ODROID_COMMON)
extern int get_boot_device(void);
static int bootm_add_ignore_to_fdt(void)
{
struct fdt_header *fdth = NULL;
ulong fdt_mem_addr;
char *pathp = NULL;
int nodeoffset;
int ret;

if (getenv("fdt_addr_r"))
fdt_mem_addr = simple_strtoul(getenv("fdt_addr_r"), NULL, 16);
else
fdt_mem_addr = simple_strtoul(getenv("dtb_mem_addr"), NULL, 16);

images.ft_addr = (char *)map_sysmem(fdt_mem_addr, 0);
fdth = (struct fdt_header *)(images.ft_addr);

switch (get_boot_device()) {
case 1: // emmc boot
pathp = "/sd/sd";
break;
case 4: //sd boot
pathp = "/emmc/emmc";
break;
}

nodeoffset = fdt_path_offset (fdth, pathp);

if (nodeoffset < 0) {
printf("libfdt fdt_path_offset() returned %s\n",
fdt_strerror(nodeoffset));
return 1;
}

ret = fdt_setprop(fdth, nodeoffset, "ignore", NULL, 0);

if (ret == -FDT_ERR_NOSPACE) {
fdt_shrink_to_minimum(fdth);
ret = fdt_setprop(fdth, nodeoffset, "ignore", NULL, 0);
}

if (ret < 0) {
printf("libfdt fdt_setprop(): %s\n", fdt_strerror(ret));
return 1;
}

return 0;
}
#endif

#ifdef CONFIG_OF_LIBFDT_OVERLAY
static int do_fdt_overlay(void)
{
Expand Down Expand Up @@ -451,6 +502,10 @@ static int bootm_find_fdt(int flag, int argc, char * const argv[])

set_working_fdt_addr(images.ft_addr);

#if defined(CONFIG_ODROID_COMMON)
bootm_add_ignore_to_fdt();
#endif

#ifdef CONFIG_OF_LIBFDT_OVERLAY
do_fdt_overlay();
#endif
Expand Down

0 comments on commit fa5dd20

Please sign in to comment.