Date: Thu, 25 Feb 2010 15:27:13 +0000 (UTC) From: Rafal Jaworowski <raj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r204316 - head/sys/boot/uboot/common Message-ID: <201002251527.o1PFRDYo051368@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: raj Date: Thu Feb 25 15:27:13 2010 New Revision: 204316 URL: http://svn.freebsd.org/changeset/base/204316 Log: Let loader(8) for U-Boot use default storage more flexibly. Obtained from: Semihalf MFC after: 1 week Modified: head/sys/boot/uboot/common/main.c Modified: head/sys/boot/uboot/common/main.c ============================================================================== --- head/sys/boot/uboot/common/main.c Thu Feb 25 15:21:37 2010 (r204315) +++ head/sys/boot/uboot/common/main.c Thu Feb 25 15:27:13 2010 (r204316) @@ -117,6 +117,7 @@ main(void) { struct api_signature *sig = NULL; int i; + struct open_file f; if (!api_search_sig(&sig)) return (-1); @@ -168,18 +169,28 @@ main(void) printf("(%s, %s)\n", bootprog_maker, bootprog_date); meminfo(); - /* XXX only support netbooting for now */ - for (i = 0; devsw[i] != NULL; i++) + for (i = 0; devsw[i] != NULL; i++) { + printf("\nDevice %d: %s\n", i, devsw[i]->dv_name); + + currdev.d_dev = devsw[i]; + currdev.d_type = currdev.d_dev->dv_type; + currdev.d_unit = 0; + + if (strncmp(devsw[i]->dv_name, "disk", + strlen(devsw[i]->dv_name)) == 0) { + f.f_devdata = &currdev; + currdev.d_disk.pnum = 0; + if (devsw[i]->dv_open(&f,&currdev) == 0) + break; + } + if (strncmp(devsw[i]->dv_name, "net", strlen(devsw[i]->dv_name)) == 0) break; + } if (devsw[i] == NULL) - panic("no network devices?!"); - - currdev.d_dev = devsw[i]; - currdev.d_type = currdev.d_dev->dv_type; - currdev.d_unit = 0; + panic("No boot device found!"); env_setenv("currdev", EV_VOLATILE, uboot_fmtdev(&currdev), uboot_setcurrdev, env_nounset);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002251527.o1PFRDYo051368>