diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2016-05-14 20:00:25 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2016-05-14 20:00:25 +0000 |
commit | f89f9aa76145b43a74717827e1ad14916afaeea1 (patch) | |
tree | 823903ba073d4b9877d8fc5058c5301e2492ec22 /sys/arch | |
parent | 47379edbe44f328b968f4f2f98f50ba34903858a (diff) |
Handle boot options, and pass the boot device to the kernel. The boot device
is currently hardcoded to be sd0. Still need to figure out how we will do
proper boot device selection when we start using the FDT.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/armv7/stand/efiboot/conf.c | 4 | ||||
-rw-r--r-- | sys/arch/armv7/stand/efiboot/efiboot.c | 4 | ||||
-rw-r--r-- | sys/arch/armv7/stand/efiboot/exec.c | 55 |
3 files changed, 30 insertions, 33 deletions
diff --git a/sys/arch/armv7/stand/efiboot/conf.c b/sys/arch/armv7/stand/efiboot/conf.c index 5207c711052..fc95798b698 100644 --- a/sys/arch/armv7/stand/efiboot/conf.c +++ b/sys/arch/armv7/stand/efiboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.1 2016/05/14 17:55:15 kettenis Exp $ */ +/* $OpenBSD: conf.c,v 1.2 2016/05/14 20:00:24 kettenis Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -45,7 +45,7 @@ struct fs_ops file_system[] = { int nfsys = nitems(file_system); struct devsw devsw[] = { - { "efi", efistrategy, efiopen, eficlose, efiioctl }, + { "sd", efistrategy, efiopen, eficlose, efiioctl }, }; int ndevs = nitems(devsw); diff --git a/sys/arch/armv7/stand/efiboot/efiboot.c b/sys/arch/armv7/stand/efiboot/efiboot.c index aab2df33a56..3265ce28e11 100644 --- a/sys/arch/armv7/stand/efiboot/efiboot.c +++ b/sys/arch/armv7/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.2 2016/05/14 19:45:37 kettenis Exp $ */ +/* $OpenBSD: efiboot.c,v 1.3 2016/05/14 20:00:24 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net> @@ -291,7 +291,7 @@ getsecs(void) void devboot(dev_t dev, char *p) { - strlcpy(p, "efi0a", 6); + strlcpy(p, "sd0a", 5); } int diff --git a/sys/arch/armv7/stand/efiboot/exec.c b/sys/arch/armv7/stand/efiboot/exec.c index f550f6c02a1..02c12f0a0d0 100644 --- a/sys/arch/armv7/stand/efiboot/exec.c +++ b/sys/arch/armv7/stand/efiboot/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.2 2016/05/14 18:26:39 kettenis Exp $ */ +/* $OpenBSD: exec.c,v 1.3 2016/05/14 20:00:24 kettenis Exp $ */ /* * Copyright (c) 2006, 2016 Mark Kettenis @@ -55,7 +55,7 @@ struct uboot_tag_mem32 { uint32_t start; }; struct uboot_tag_cmdline { - char cmdline[1]; + char cmdline[64]; }; #define ATAG_CORE 0x54410001 @@ -75,16 +75,16 @@ struct uboot_tag { } u; }; -struct uboot_tag tags[2]; +struct uboot_tag tags[3]; void run_loadfile(u_long *marks, int howto) { -#ifdef BOOT_ELF Elf_Ehdr *elf = (Elf_Ehdr *)marks[MARK_SYM]; Elf_Shdr *shp = (Elf_Shdr *)(marks[MARK_SYM] + elf->e_shoff); u_long esym = marks[MARK_END] & 0x0fffffff; u_long offset = 0; + char args[256]; char *cp; int i; @@ -102,36 +102,33 @@ run_loadfile(u_long *marks, int howto) break; } } -#endif - -#if 0 - cp = (char *)0x00200000 - MAX_BOOT_STRING - 1; - -#define BOOT_STRING_MAGIC 0x4f425344 - *(int *)cp = BOOT_STRING_MAGIC; - - cp += sizeof(int); - snprintf(cp, MAX_BOOT_STRING, "%s:%s -", cmd.bootdev, cmd.image); - - while (*cp != '\0') - cp++; - if (howto & RB_ASKNAME) - *cp++ = 'a'; - if (howto & RB_CONFIG) - *cp++ = 'c'; - if (howto & RB_KDB) - *cp++ = 'd'; - if (howto & RB_SINGLE) - *cp++ = 's'; - - *cp = '\0'; -#endif + snprintf(args, sizeof(args) - 8, "%s:%s", cmd.bootdev, cmd.image); + cp = args + strlen(args); + + *cp++ = ' '; + *cp = '-'; + if (howto & RB_ASKNAME) + *++cp = 'a'; + if (howto & RB_CONFIG) + *++cp = 'c'; + if (howto & RB_SINGLE) + *++cp = 's'; + if (howto & RB_KDB) + *++cp = 'd'; + if (*cp == '-') + *--cp = 0; + else + *++cp = 0; tags[0].hdr.tag = ATAG_MEM; - tags[0].hdr.size = sizeof(struct uboot_tag); + tags[0].hdr.size = sizeof(struct uboot_tag) / sizeof(uint32_t); tags[0].u.mem.start = 0x10000000; tags[0].u.mem.size = 0x80000000; + tags[1].hdr.tag = ATAG_CMDLINE; + tags[1].hdr.size = sizeof(struct uboot_tag) / sizeof(uint32_t); + strlcpy(tags[1].u.cmdline.cmdline, args, + sizeof(tags[1].u.cmdline.cmdline)); memcpy((void *)0x10000000, tags, sizeof(tags)); |