bootloader/notes.org
2023-03-15 19:25:19 +01:00

2.5 KiB

#+TITLE:Quibble bootloader reasoned


Btrfs driver

structures

volume

EFI_SIMPLE_FILE_SYSTEM_PROTOCOL: proto
EFI_QUIBBLE_PROTOCOL: quibble_proto
EFI_OPEN_SUBVOL_PROTOCOL: open_subvol_proto
superblock*: sb
checksum
uuid
EFI_HANDLE: controller
EFI_BLOCK_IO_PROTOCOL*: block
EFI_DISK_IO_PROTOCOL*: disk_io
bool: chunks_loaded
LIST_ENTRY: chunks
LIST_ENTRY: roots
root*: root_root
root*: chunk_root
LIST_ENTRY: list_entry
root*: fsroot

efi_main

  • initialize volumes list
  • construct global driver bind structure
  • install driver protocol

drv_start

  • walk list of volumes and check for controller handle
  • open block_io protocol and ensure media->blocksize isnt 0
  • open disk_io protocol
  • read superblock and check magic and crc32
  • check for incompat flags
  • setup volume struct with protocols/functions:
  • install protocols and store volume in global list

open_volume

  • ensure chunks are loaded
  • populate file handle
  • construct inode from fsroot and vol
load_chunks
populate_file_handle

get_arc_name

returns superblock uuid field

get_driver_name

just returns "btrfs"

open_subvol

drv_stop

  • cleanup / deallocating
  • close diskio/blockio protocols

drv_supported

  • checks for disk_io and block_io

boot function

find and open btrfs disk and subvol, if specified

check for, and open system32 folder add_image kernel executable and hal library

add_image

args

  • images list
  • image name and dir
  • memory type SystemCode for kernel, HalCode for hal.dll
  • is dll?
  • bdle / boot driver list entry always null
  • order load order of drivers
  • no_reloc false for kernel and HAL, and drivers

function

keeps track of image in a linked list

add kernel and hal to image list

kernel image

should we look for alternate kernel images? *mp,*pa,*amp

process memory map

load kernel

load registry

load apiset if >= win8

add crashdmp driver if >= win8 blue to image list

load image list, drivers, add dependencies to image list

fix image order

iterate thru images again, resolve imports

make images contiguous

construct kernel stack/arguments

map images?

stuff

call kernel entry