This manual page describes how to set up Windows to boot NetBSD, in such a way as to avoid the problem described above. It assumes that Windows is the default OS on your multiboot system, since if NetBSD were the default, you could simply use the Reboot option of the Windows shutdown menu.
Begin by creating the directory
C:\NetBSD
on your Windows system. You may use another name if you prefer; just be
sure to edit the paths in the instructions below accordingly.
In that directory, place a copy of
DOSBOOT.COM
,
which can be found on your
NetBSD
system as
/usr/mdec/dosboot.com
.
You can use
ftp(1)
or the msdosfs
file system (see
mount_msdos(8))
to transfer the file from
NetBSD
to Windows.
Next create the script
GoNetBSD.BAT
in that directory, containing the following lines:
@ECHO OFF
IF EXIST C:\NetBSD\BOOTED GOTO towin
ECHO >C:\NetBSD\BOOTED
CHOICE /C+ /N /T+,5
C:\NetBSD\DOSBOOT -u
ECHO Error booting NetBSD
CHOICE /C+ /N /T+,60
:towin
DEL C:\NetBSD\BOOTED
ECHO Y >C:\NetBSD\Y
CHOICE /C+ /N /T+,5
C:\WINDOWS\WIN.COM <Y
Now, double click the icon for the dosboot(8) program. Windows will bring up a requester entired ``Program Requires MS-DOS Mode''. Select ``Yes'' to create a shortcut. Turn off the ``Mouse'' checkmark on the window that appears and click ``OK''.
Now right-click the
dosboot.pif
file that was created. This will be the icon that says
dosboot
with the MS-DOS logo.
Choose ``rename'' and change the name to
GoNetBSD
.
Right click this newly-renamed icon again and select ``Properties''.
Click to the ``Program'' tab. Edit the first text field to
``GoNetBSD''. Edit the ``Cmd line'' text field to read
``C:\NetBSD\GoNetBSD.BAT
''.
Ensure the ``Batch file'' field is blank.
Click on the ``Advanced'' button. Make sure ``MS-DOS Mode'' is checked.
Uncheck the ``Warn before entering MS-DOS Mode'' checkbox if you intend
to use the GoNetBSD script from another program, such as the Microsoft
Plus! System Agent. Click ``OK'' to exit the ``Advanced Program Settings''
window. Click ``OK'' to exit the ``Properties'' window.
Now you can click the GoNetBSD.BAT icon to boot into NetBSD.
To set up GoNetBSD to run under System Agent, follow these steps. First, double click the System Agent icon on the taskbar tray. This will open the System Agent window. Select ``Schedule a New Program'' from the ``Program'' menu. In the ``Program'' text field, enter the complete path to the GoNetBSD batch file, for example ``C:\NetBSD\GoNetBSD.BAT''. In the ``Description'' text field, enter a descriptive name for the scheduled event, such as ``Reboot system under NetBSD''.
Now click the ``When to Run program'' and select the time schedule for the switch to NetBSD. It is advisable to use the ``Wait until I haven't used my computer for...'' feature to prevent the switch if someone is actively using windows at the time the switch is to occur. Now click on the ``Advanced'' button, and set a deadline that is shortly after (say, two minutes) the start time. If you return from NetBSD before the deadline, System Agent will believe that the program did not complete successfully, and switch you back to NetBSD. Setting a very short deadline will prevent this.
Now click ``OK'' in that window and the previous window to get back to the System Agent main window, and then close System Agent. Your system will now automatically switch to NetBSD at the specified time or times.
If you wish to have NetBSD reboot to Windows after some amount of time, the cron(8) or at(1) programs in conjunction with reboot(8) or shutdown(8) may be useful.