Date: Thu, 08 Nov 2007 12:26:53 +0000 From: Alex Zbyslaw <xfb52@dial.pipex.com> To: Craig Boston <cb@severious.net>, freebsd-questions@freebsd.org Subject: Re: how to change next boot from windows to freebsd? Message-ID: <4733008D.1070402@dial.pipex.com> In-Reply-To: <20070913205954.GA5814@nowhere> References: <1025711279.20070912121635@pulsar.bg> <20070913205954.GA5814@nowhere>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------000203040803090405020202 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Craig Boston wrote: >Attached is the source to a program that I wrote about 4 and a half >years ago. It performs the function of a dumbed-down boot0cfg for >Windows, only understanding the "-s" option, or giving you an >interactive menu to choose from. It also is hardcoded to use >PhysicalDrive0, but that's usually what you would boot from. > > Thank you, Craig! I've been looking for something like this and found your email in my spam folder where my mail system kindly files messages it doesn't want me to see :-) A wee problem-ette for me is that I have FreeBSD on a separate disk from Windows so I wanted to be able to set the "Next Disk" option from windows to boot FreeBSD (a.k.a. F5). I've confirmed that this is just stored as 4 in the MBR (partition -1, just like the rest). boot0cfg allows 5 as a legitimate slice. This patch allows you to set partitions from 1-5 instead of 1-4 from the command line, and also adds an automatic "5: Next disk" option in the in the interactive invocation. Now to figure out how to shut down/reboot windows from a bat file so I can do one double-click and not faff around with the Start menu... --Alex --------------000203040803090405020202 Content-Type: text/plain; name="nextboot.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="nextboot.c.patch" --- nextboot.c.orig Wed Nov 7 18:06:04 2007 +++ nextboot.c Thu Nov 8 12:17:25 2007 @@ -414,6 +414,8 @@ i + 1, getptype(part[i].dp_typ)); } + printf ("%c5. Next disk\n", (mbr[OFF_OPT] == 4) ? '*' : ' '); + printf("\nSelect partition: "); fgets(resp, 255, stdin); @@ -421,7 +423,7 @@ return 0; pnum = atol(resp) - 1; - if (pnum < 0 || pnum > 3 || !part[pnum].dp_typ) + if (pnum < 0 || pnum > 4 || (pnum < 4 && !part[pnum].dp_typ)) { fprintf(stderr, "Invalid partition\n"); return 1; @@ -434,8 +436,8 @@ { fprintf(stderr, "Usage:\n\n" " nextboot (For interactive menu)\n\n" - " nextboot [1-4] (Set partition to boot from)\n" - " nextboot -s [1-4]\n" + " nextboot [1-5] (Set partition to boot from)\n" + " nextboot -s [1-5]\n" "\n"); return 0; } @@ -448,7 +450,7 @@ return menuboot(); else if ((argc == 2) && (strlen(argv[1]) == 1) && - (argv[1][0] >= '1' && argv[1][0] <= '4')) + (argv[1][0] >= '1' && argv[1][0] <= '5')) { act = atol(argv[1]); return setnextboot(act - 1); @@ -456,7 +458,7 @@ else if ((argc == 3) && !stricmp(argv[1], "-s") && (strlen(argv[2]) == 1) && - (argv[2][0] >= '1' && argv[2][0] <= '4')) + (argv[2][0] >= '1' && argv[2][0] <= '5')) { act = atol(argv[2]); return setnextboot(act - 1); --------------000203040803090405020202--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4733008D.1070402>