Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Understanding the boot loader
#1
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?
Reply
#2
(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.
Reply
#3
(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/ma...yWorker.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.
Reply
#4
(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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)