Beispiel #1
0
/*
 * disk boot
 *       devnm   device name (possibly with the partition number)
 *               if it is NULL, the standard search order is used to look for a bootable device.
 *       return value error code
 */
EXPORT ER bootDisk( const UB *devnm )
{
	DISKCB	*dcb;
	W	pno, i, c;
	ER	err;

	if ( devnm != NULL ) {
                /* boot from the specified device */
		pno = loadPBoot(devnm, &dcb);
		if ( pno < E_OK ) return pno;
	} else {
                /* Boot using the standard boot order */
		pno = E_BOOT;
		for ( i = 0;; i++ ) {
			devnm = bootDevice(i);
			if ( devnm == NULL ) break; /* end is seen */

			pno = loadPBoot(devnm, &dcb);
			if ( pno >= 0 ) break;
		}
	}
	if ( pno >= 0 ) {
                /* Length of the device name without the partition number */
		i = strlen(devnm);
		c = devnm[i - 1];
		if ( i >= 2 && c >= '0' && c <= '3' ) --i;

                /* Set boot information */
		strncpy(bootInfo.devnm, devnm, L_DEVNM);
		bootInfo.devnm[i] = '\0'; /* erase partition number */
		bootInfo.part  = pno - 1;
		bootInfo.start = dcb->part[pno].sblk;
		bootInfo.secsz = dcb->blksz;

                /* prepare for primary boot execution */
		setUpBoot(PBootAddr, &bootInfo);

	} else {
                /* if boot from disk fails
                   try invoking ROM kernel */
		err = bootROM();
		if ( err < E_OK ) {
			if ( err != E_ABORT ) err = pno;
			return err;
		}
	}

	return E_OK;
}
Beispiel #2
0
/*
 * display help message with disk name listing
 */
LOCAL void prDiskHelp( const HELP *help )
{
	const UB *devnm;
	UW	attr;
	W	i;

	DSP_S(help->msg);
	DSP_S("  device :");
	for ( i = 0;; ++i ) {
		devnm = ( help == &helpBD )? bootDevice(i): diskList(i, &attr);
		if ( devnm == NULL ) break;

                /* exclude devices that can not be specified */
		if ( help == &helpWD && (attr & DA_RONLY) != 0 ) continue;
		DSP_F2(CH,' ', S,devnm);
	}
	DSP_LF;
}