Ventoy Forums
Understanding the boot loader - Printable Version

+- Ventoy Forums (https://forums.ventoy.net)
+-- Forum: Ventoy General Use —— Ventoy 使用交流 (https://forums.ventoy.net/forumdisplay.php?fid=1)
+--- Forum: Ventoy Discussion Forum (https://forums.ventoy.net/forumdisplay.php?fid=2)
+--- Thread: Understanding the boot loader (/showthread.php?tid=2769)



Understanding the boot loader - balanga - 01-26-2024

I'm trying to figure out how the boot loader works, and it seems to me that it consists of two files boot.img and core.img.

Can someone confirm that that is the case?


RE: Understanding the boot loader - 0x6A7232 - 02-05-2024

(01-26-2024, 10:45 PM)balanga Wrote: I'm trying to figure out how the boot loader works, and it seems to me that it consists of two files boot.img and core.img.

Can someone confirm that that is the case?

Yes. Look in the Linux version VentoyWorker.sh in the tool folder (looks like Windows does all the work inside of the .exe so you can't see it there) and ctrl+F for core.img and boot.img

You can find where it puts boot.img into the mbr and core.img into the 1MB space at the beginning of the disk before the first partition.


RE: Understanding the boot loader - balanga - 02-17-2024

(02-05-2024, 09:36 PM)0x6A7232 Wrote:
(01-26-2024, 10:45 PM)balanga Wrote: I'm trying to figure out how the boot loader works, and it seems to me that it consists of two files boot.img and core.img.

Can someone confirm that that is the case?

Yes. Look in the Linux version VentoyWorker.sh in the tool folder (looks like Windows does all the work inside of the .exe so you can't see it there) and ctrl+F for core.img and boot.img

You can find where it puts boot.img into the mbr and core.img into the 1MB space at the beginning of the disk before the first partition.
I know this but looking at the code in 

https://github.com/ventoy/Ventoy/blob/master/INSTALL/tool/VentoyWorker.sh

specifically lines 335+ :-


if [ -n "$VTGPT" ]; then
        echo -en '\x22' | dd status=none of=$DISK conv=fsync bs=1 count=1 seek=92
        xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2014 seek=34
        echo -en '\x23' | dd of=$DISK conv=fsync bs=1 count=1 seek=17908 status=none
    else
        xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1
    fiif [ -n "$VTGPT" ]; then
        echo -en '\x22' | dd status=none of=$DISK conv=fsync bs=1 count=1 seek=92
        xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2014 seek=34
        echo -en '\x23' | dd of=$DISK conv=fsync bs=1 count=1 seek=17908 status=none
    else
        xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1
    fi

I can't figure out what the lines '\x22' and '\x23' are supposed to do.


RE: Understanding the boot loader - nguyen ha thai trong - 03-05-2024

(01-26-2024, 10:45 PM)balanga Wrote: I'm trying to figure out how the boot loader works, and it seems to me that it consists of two files boot.img and core.img.

Can someone confirm that that is the case?
You guessed it right