Exercise \- Feature Customization - Boot Order
Note
In this exercise, we’ll learn how to change boot order from source code.
You can execute SBL with the following steps:
Check current boot order in QEMU:
Look through the boot log on Command Prompt and locate string
Getting boot image from...
to determine the 1st boot device:python BuildLoader.py build qemu
Modify board specific library,
in file
<sbl_tree>\Platform\QemuBoardPkg\Library\Stage2BoardInitLib\Stage2BoardInitLib.c
In function
UpdateOsBootMediumInfo ()
Add following at the end of the function to override the boot order:
OsBootOptionList->CurrentBoot = 2;
Rebuild SBL by using the following command:
python BuildLoader.py build qemu
Completion: you will see
Done [qemu]
on the screen after compile completedExecute SBL on QEMU by using the following command:
Windows:
"C:\Program Files\qemu\qemu-system-x86_64.exe" -m 256M -machine q35 -serial stdio -pflash Outputs\qemu\SlimBootloader.bin -drive id=mydisk,if=none,file=..\Misc\QemuImg\QemuSata.img,format=raw -device ide-hd,drive=mydisk -boot order=dLinux:
qemu-system-x86_64 -m 256M -machine q35 -serial mon:stdio -nographic -pflash Outputs/qemu/SlimBootloader.bin -drive id=mydisk,if=none,file=../Misc/QemuImg/QemuSata.img,format=raw -device ide-hd,drive=mydisk -boot order=d
Check the console Window to see the difference
Tip
Board customization can be done through board specific libraries, such as <sbl_tree>\Stage1ABoardInit/Stage1BBoardInit/Stage2BoardInit