Add ider-floppy and ider-cdrom as boot options to amtpower
Chris Thornton committed
Apr 4, 2022 at 14:21 UTC
4a516a9f8cea2407967ea4be9079b40a0f43ba49
1 file changed
+17
-10
agents/meshcmd.js
+17
-10
@@ -295,10 +295,10 @@ function run(argv) {
295
console.log(' --pass [password] The Intel AMT login password.');
296
console.log('\r\nOptional arguments:\r\n');
297
console.log(' --reset, --poweron, --poweroff, --powercycle, --sleep, --hibernate');
298
- console.log(' --user [username] The Intel AMT login username, admin is default.');
299
- console.log(' --tls Specifies that TLS must be used.');
300
- console.log(' --bootdevice [pxe|hdd|cd] Specifies the boot device to use after reset, poweron or powercycle.');
301
- console.log(' --bootindex [number] Specifies the index of boot device to use.');
298
+ console.log(' --user [username] The Intel AMT login username, admin is default.');
299
+ console.log(' --tls Specifies that TLS must be used.');
300
+ console.log(' --bootdevice [pxe|hdd|cd|ider-floppy|ider-cdrom] Specifies the boot device to use after reset, poweron or powercycle.');
301
+ console.log(' --bootindex [number] Specifies the index of boot device to use.');
302
} else if (action == 'amtnetwork') {
303
console.log('AmtNetwork is used to get/set Intel AMT network interface configuration. Example usage:\r\n\r\n meshcmd amtnetwork --host 1.2.3.4 --user admin --pass mypassword --dhcp');
304
console.log('\r\nRequired arguments:\r\n');
@@ -842,13 +842,20 @@ function run(argv) {
842
//if (settings.poweraction == 0) { console.log('No power action, specify --poweron, --sleep, --powercycle, --poweroff, --hibernate, --reset.'); exit(1); return; }
843
// Accepted option for boot device are: pxe, hdd, cd
844
var bootdevices = ['pxe','hdd','cd'];
845
+ var ider_bootdevices = ['ider-floppy', 'ider-cdrom']
846
if (args.bootdevice) {
847
if (bootdevices.indexOf(args.bootdevice.toLowerCase())>=0) {
848
settings.bootdevice = args.bootdevice
849
// Set bootindex to 0 by default, unless overriden
850
settings.bootindex = 0
851
+ settings.ider_bootindex = 0
852
+ settings.ider_boot = false;
853
+ } else if (ider_bootdevices.indexOf(args.bootdevice.toLowerCase())>=0) {
854
+ settings.bootindex = 0
855
+ settings.ider_bootindex = ider_bootdevices.indexOf(args.bootdevice.toLowerCase());
856
+ settings.ider_boot = true;
857
} else {
851
- console.log('Supported boot devices are pxe, hdd, cd'); exit(1); return;
858
+ console.log('Supported boot devices are pxe, hdd, cd, ider-floppy, ider-cdrom'); exit(1); return;
859
}
860
}
861
// boot index for cd and hdd
@@ -2945,7 +2952,7 @@ function performAmtPowerAction() {
2952
amtstack = new amt(wsstack);
2953
if (settings.poweraction != 0) {
2954
// Check if there is bootdevice and the command is either poweron, powercycle or reset
2948
- if (settings.bootdevice && [2,5,10].indexOf(settings.poweraction)>=0) {
2955
+ if ((settings.bootdevice || settings.ider_boot) && [2,5,10].indexOf(settings.poweraction)>=0) {
2956
// Change boot order
2957
amtstack.Get('AMT_BootSettingData', powerActionResponse1, 0, 1);
2958
} else {
@@ -2972,14 +2979,14 @@ function powerActionResponse1(stack, name, response, status) {
2979
}
2980
r['FirmwareVerbosity'] = 0;
2981
r['ForcedProgressEvents'] = false;
2975
- r['IDERBootDevice'] = 0;
2982
+ r['IDERBootDevice'] = settings.ider_bootindex;
2983
r['LockKeyboard'] = false;
2984
r['LockPowerButton'] = false;
2985
r['LockResetButton'] = false;
2986
r['LockSleepButton'] = false;
2987
r['ReflashBIOS'] = false;
2981
- r['UseIDER'] = false;
2982
- r['UseSOL'] = false;//
2988
+ r['UseIDER'] = settings.ider_boot;
2989
+ r['UseSOL'] = settings.ider_boot
2990
r['UseSafeMode'] = false;
2991
r['UserPasswordBypass'] = false;
2992
if (r['SecureErase'] != null) {
@@ -3014,7 +3021,7 @@ function powerActionResponse3(stack, name, response, status) {
3021
if (status != 200) { console.log('SetBootConfigRole failed.'); exit(1); return; }
3022
var bootsources = { 'pxe' : 'Force PXE Boot', 'hdd' : 'Force Hard-drive Boot', 'cd' : 'Force CD/DVD Boot'};
3023
var cbparam='<Address xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing</Address><ReferenceParameters xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><ResourceURI xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_BootSourceSetting</ResourceURI><SelectorSet xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"><Selector Name="InstanceID">Intel(r) AMT: ' + bootsources[settings.bootdevice] + '</Selector></SelectorSet></ReferenceParameters>';
3017
- if (!settings.bootdevice) { cbparam=null;}
3024
+ if (!(settings.bootdevice in bootsources)) { cbparam=null;}
3025
amtstack.CIM_BootConfigSetting_ChangeBootOrder(cbparam, function(st, nm, resp, sts) {
3026
if (resp.Body['ReturnValue'] != 0) { console.log('(2) Change Boot Order returns '+ resp.Body.ReturnValueStr); exit(1); return; }
3027
amtstack.RequestPowerStateChange(settings.poweraction, performAmtPowerActionEx);