A minimal x86 kernel
- Install cross compiler:
brew install x86_64-elf-gcc objconv - Clone GRUB:
git clone git://git.savannah.gnu.org/grub.git - Run GRUB's autogen:
cd grub && ./autogen.sh - Configure GRUB build:
../grub/configure --disable-werror TARGET_CC=x86_64-elf-gcc TARGET_OBJCOPY=x86_64-elf-objcopy TARGET_STRIP=x86_64-elf-strip TARGET_NM=x86_64-elf-nm TARGET_RANLIB=x86_64-elf-ranlib --target=x86_64-elf - Build and install GRUB:
make && make install
- Prerequisites:
brew install balena-cli - Insert the usb device
- Run
./flashusb.sh - Select the usb device to flash and hit Enter
- Enter 'y' when prompted (pass
-yto./flashusb.shto skip this step)
- Get a disassembly of the kernel
x86_64-elf-objdump -D build/alpine.kernel > kernel.dump
- Get debug logs and cpu traces from Qemu
- Enable logging:
./qemu.sh -D qemu.log - Log interrupts/exceptions: add
-d int - Log cpu state before reset: add
-d cpu_reset - Get list of supported logs:
qemu-system-x86_64 -d --help
- Enable logging: