1
votes

I'm developing a system that runs on a live USB Linux. In order to ease the utilization for users, we need to develop an Windows executable. When executed, this executable should detect our USB stick on Windows and prepare it so on the next boot the computer will boot from it.

We want to reproduce this procedure (https://askleo.com/how_do_i_boot_from_cddvdusb_in_windows_8/) with this behavior:

Boot from USB

But instead of forcing the user to restart pressing shift and selecting "Use a device", we want to do this automatically.

I've searched a lot and found about BCDedit. Inside it, there is a command /bootsequence (https://technet.microsoft.com/en-us/magazine/ff700231.aspx) that states:

BCD Edit makes this easy to do using the /bootsequence command.

At an elevated command prompt, enter the following command: bcdedit /bootsequence {975a8204-9658-11dd-993e-9aea7965e9da}

Simply change the identifier—in this example, {975a8204-9658-11dd-993e-9aea7965e9da}—to the identifier for the operating system that you want to boot when you restart the computer.

However, I found no clue on how to detect the boot partition on Linux (the /boot is in a ext2 partition inside the flashdrive) and use /bootsequence to boot from it.

Any ideas/APIs or guides on how to do that?

I'm really desperate to find and solve this.

Regards,

1

1 Answers

1
votes

You will have a hard time booting Linux from the Windows boot loader. The linux USB drive will boot most easily when it is the bootloader selected by the BIOS. You may be able to achieve what you are trying by modifying the BIOS programatically. The challenge there will be you will have to have code for each BIOS manufacturer and not all will support being edited from outside their menu.