-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.nub
More file actions
65 lines (60 loc) · 2.47 KB
/
build.nub
File metadata and controls
65 lines (60 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
KERNEL_DIR = kernel/src
BOOT_DIR = bootloader
BUILD = kernel/src/build
ESP = bootloader/esp/EFI/BOOT
KFLAGS = -ffreestanding -fno-stack-protector -fno-pic -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -I./kernel/include
BFLAGS = -ffreestanding -fno-stack-protector -fpic -fshort-wchar -mno-red-zone -I/usr/include/efi -I/usr/include/efi/x86_64 -DEFI_FUNCTION_WRAPPER
usb = sda1
/b{
sh: echo building bootloader
sh: gcc (BFLAGS) -c (BOOT_DIR)/boot.c -o (BOOT_DIR)/boot.o
sh: ld -nostdlib -znocombreloc -T /usr/lib/elf_x86_64_efi.lds -shared -Bsymbolic /usr/lib/crt0-efi-x86_64.o (BOOT_DIR)/boot.o -o (BOOT_DIR)/boot.so -L/usr/lib -lefi -lgnuefi
sh: objcopy -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .reloc --target=efi-app-x86_64 (BOOT_DIR)/boot.so (BOOT_DIR)/boot.efi
sh: cp (BOOT_DIR)/boot.efi (ESP)/BOOTX64.EFI
}
/k{
sh: echo building kernel
sh: mkdir -p (BUILD)
sh: gcc (KFLAGS) -c (KERNEL_DIR)/kernel.c -o (BUILD)/kernel.o
sh: gcc (KFLAGS) -c (KERNEL_DIR)/memory.c -o (BUILD)/memory.o
sh: gcc (KFLAGS) -c (KERNEL_DIR)/tty.c -o (BUILD)/tty.o
sh: gcc (KFLAGS) -mgeneral-regs-only -c (KERNEL_DIR)/gdt.c -o (BUILD)/gdt.o
sh: gcc (KFLAGS) -c (KERNEL_DIR)/input.c -o (BUILD)/input.o
sh: nasm -f elf64 (KERNEL_DIR)/gdt.asm -o (BUILD)/gdta.o
sh: ld -nostdlib -static -e main -Ttext 0x100000 (BUILD)/kernel.o (BUILD)/input.o (BUILD)/memory.o (BUILD)/tty.o (BUILD)/gdt.o (BUILD)/gdta.o -o (BUILD)/kernel.elf
sh: cp (BUILD)/kernel.elf (BOOT_DIR)/esp/
}
/r{
sh: qemu-system-x86_64 -bios /usr/share/ovmf/OVMF.fd -drive format=raw,file=fat:rw:(BOOT_DIR)/esp -device isa-debug-exit,iobase=0x501,iosize=0x1
}
/f{
sh: echo flashing
sh: echo dont worry it asks for sudo to mount and flash, check file build.nub line 34!
sh: sudo mount /dev/(usb) /mnt
sh: sudo mkdir -p /mnt/EFI/BOOT
sh: sudo cp (BOOT_DIR)/boot.efi /mnt/EFI/BOOT/BOOTX64.EFI
sh: sudo cp (BUILD)/kernel.elf /mnt/kernel.elf
sh: sudo umount /mnt
sh: echo flashed successfully
}
/c{
sh: rm -rf (BUILD)
sh: rm -f (BOOT_DIR)/boot.o (BOOT_DIR)/boot.so (BOOT_DIR)/boot.efi
sh: echo cleaned
}
gitmsg = First command!!!!
/g{
sh: git add .
sh: git commit -m "(gitmsg)"
sh: git push
}
/i{
sh: echo dont worry it asks for sudo to install. check file build.nub line 53!
sh: sudo apt update && sudo apt install -y gcc nasm binutils ovmf qemu-system-x86 gnu-efi
sh: echo installed dependencies
}
main{
fn: b
fn: k
fn: r
}