              <<< NOTED::NOTES$7:[NOTES$LIBRARY]HACKERS.NOTE;1 >>>
                               -< ** Hackers ** >-
================================================================================
Note 1633.0              Change Boot Device on Alpha AXP              21 replies
EEMELI::MOSER "Orienteers do it in the bush..."      62 lines   9-DEC-1993 09:25
--------------------------------------------------------------------------------
    
    Following a discussion in ALPHANOTES, I'm providing a quick and dirty
    method for changing the boot device on a Alpha AXP machine and forcing
    a cold reboot. This might be particularly useful, if you're not sitting
    physical at your machine, but like to switch system disks for example.
    
    The following code works on my DEC 3000 Model 500 running either
    OpenVMS AXP V1.5 or T2.0-FT3. It will change the boot device to be
    DKA300. I leave it as an exercise to the reader to make this utility
    more flexible (i.e. no hard-coded device names, checking if that disk
    is bootable etc.).
    
    And as usual with hacker stuff, take it with a grain of salt... running
    this utility will definitely 'crash' your system.
    
    /cmos
    
    
	.library	/sys$library:lib/

	$hwrpbdef
	$syspardef


	.psect	data	quad,rd,wrt,noexe
boot_dev:	.ascii	/SCSI 0 6 0 0 300 0 FLAMG-IO/
boot_dev_l	= .-boot_dev
bootcmd_dev:	.ascii	/DKA300/
bootcmd_dev_l	= .-bootcmd_dev



	.psect	code	quad,rd,nowrt,exe

	.entry	boot,^m<>
	$cmkrnl_s -				; must do it from kernel mode
		routin=boot_krnl
	ret					; shouldn't end up here

	.entry	boot_krnl,^m<r2,r3,r4>
	movl	g^exe$gpq_hwrpb,r2		; point to HWRPB
	addl3	hwrpb$iq_crb_offset(r2),r2,r3	; point to CRB
	movl	hwrpb_crb$iq_va_dispatch_pd(r3),r4
						; dispatch PD
	pushl	#bootcmd_dev_l			; length and pointer
	pushab	bootcmd_dev			; to boot command device
	pushl	#hwrpb_crb$k_bootcmd_dev	; which env variable
	pushl	#hwrpb_crb$k_set_env		; want to set environment var
	calls	#4,(r4)				; call dispatch routine
	pushl	#boot_dev_l			; length and pointer
	pushab	boot_dev			; to boot device
	pushl	#hwrpb_crb$k_boot_dev		; which env variable
	pushl	#hwrpb_crb$k_set_env		; want to set env variable
	calls	#4,(r4)				; call dispatch routine
	
	moval	g^exe$gl_flags,r2		; exec flags
	bbcc	#exe$v_bugdump,(r2),10$		; clear bug dump flag bit
10$:	bug_check	halt,fatal,cold_boot	; bugcheck and force cold boot
	ret					; should not end up here

	.end	boot
    
