![Kontron CP3005-SA User Manual Download Page 99](http://html1.mh-extra.com/html/kontron/cp3005-sa/cp3005-sa_user-manual_1996264099.webp)
CP3005-SA – Rev. 0.6 Preliminary
// 99
13.4.3.
Examples of Startup Scripts
13.4.3.1.
Automatic Booting from USB Flash Drive
Automatic booting is made from a USB flash drive, if present, otherwise the boot is made from the harddrive.
kboot -t usb-harddrive
kboot -t harddrive
If neither a USB flash drive nor a harddrive is present, the boot order is continued.
13.4.3.2.
Execute Shell Script on Other Harddrive
This example (startup.nsh) executes the shell script named bootme.nsh located in the root of the first detected disc
drive (fs0).
fs0:
bootme.nsh
13.4.3.3.
Enable Watchdog and Control PXE Boot
The uEFI Shell provides environment variables used to control the execution flow.
The following sample start-up script shows two uEFI Shell environment variables, wdt_enable and pxe_first, used
to control the boot process and the Watchdog.
echo -off
echo “Executing sample startup.nsh...”
if %wdt_enable% == “on” then
kwdt -t 15
echo “Watchdog enabled”
endif
if %pxe_first% == “on” then
echo “forced booting from network”
kboot -t network
endif
To create uEFI Shell environment variables, use the set uEFI Shell command as shown below:
Shell> set wdt_enable on
Shell> set pxe_first on
Shell> set
pxe_first : on
wdt_enable : on
Shell> reset
13.4.3.4.
Handling the Startup Script in the SPI Boot Flash
In case there is no mass storage device attached, the startup script can be generated in a RAM disk and stored in the
SPI boot flash using the following instructions:
1.
Press <ESC> during power-up to log into the uEFI Shell.
2.
Create a RAM disk and set the proper working directory as shown below:
Shell> kramdisk -s 3 myramdisk
Shell> myramdisk:
3.
Enter the sample start-up script mentioned above in this section using the edit uEFI Shell command.
myramdisk:\> edit boot.nsh
4.
Save the start-up script to the SPI boot flash using the kbootscript uEFI Shell command.
myramdisk:\> kbootscript -p boot.nsh