-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb
More file actions
executable file
·62 lines (49 loc) · 2.84 KB
/
b
File metadata and controls
executable file
·62 lines (49 loc) · 2.84 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
rm -rf tmp
mkdir tmp
echo compiling kernel bits
echo kernel.c
$HOME/opt/cross/bin/x86_64-elf-gcc -m64 -o tmp/kernel.o -c kernel.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs -nostdinc -ffreestanding
echo pci.c
$HOME/opt/cross/bin/x86_64-elf-gcc -m64 -o tmp/pci.o -c pci.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs -nostdinc -ffreestanding
echo ps2.c
$HOME/opt/cross/bin/x86_64-elf-gcc -m64 -o tmp/ps2.o -c ps2.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs -nostdinc -ffreestanding
echo apic.c
$HOME/opt/cross/bin/x86_64-elf-gcc -m64 -o tmp/apic.o -c apic.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs -nostdinc -ffreestanding
echo pic.c
$HOME/opt/cross/bin/x86_64-elf-gcc -m64 -o tmp/pic.o -c pic.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs -nostdinc -ffreestanding
echo serial.c
$HOME/opt/cross/bin/x86_64-elf-gcc -m64 -o tmp/serial.o -c serial.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs -nostdinc -ffreestanding
echo ata_pio.c
$HOME/opt/cross/bin/x86_64-elf-gcc -m64 -o tmp/ata_pio.o -c ata_pio.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs -nostdinc -ffreestanding
echo bga.c
$HOME/opt/cross/bin/x86_64-elf-gcc -m64 -o tmp/bga.o -c bga.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs -nostdinc -ffreestanding
echo lua.c
$HOME/opt/cross/bin/x86_64-elf-gcc -m64 -o tmp/lua.o -c lua.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs -nostdinc -ffreestanding -I $HOME/because/newlib/include -I $HOME/because/lua-5.3/include -I $HOME/opt/cross/lib/gcc/x86_64-elf/4.8.1/include
/usr/local/bin/nasm -f elf64 -o tmp/bits.o bits.asm
echo linking flat 64bit kernel binary
# we use /usr/bin/local/ld b/c i compile on a mac and the default ld is inadequate.
# /usr/bin/local/ld can be installed by doing 'brew install binutils' if you have homebrew.
# if you already have gnu ld, you can just use that instead.
#
$HOME/opt/cross/bin/x86_64-elf-ld -T linker64.ld -o tmp/kernel64.sys tmp/kernel.o tmp/bits.o tmp/pci.o tmp/ps2.o tmp/apic.o tmp/pic.o tmp/serial.o tmp/ata_pio.o tmp/bga.o tmp/lua.o lua-5.3/lib/liblua.a newlib/lib/libm.a newlib/lib/libc.a newlib/lib/libnosys.a || exit
echo composing disk image
rm -rf disk.img
cp pure64/Pure64.img disk.img
echo attaching >boring.log
hdiutil attach disk.img >>boring.log
cp tmp/kernel64.sys /Volumes/BECAUSE/kernel64.sys
mkdir /Volumes/BECAUSE/LBECAUSE
cp lbecause/*.lua /Volumes/BECAUSE/LBECAUSE/
echo detaching >>boring.log
hdiutil detach /Volumes/BECAUSE >>boring.log
echo creating image for virtualbox
rm -rf disk.vdi
echo converting image using vboxmanage >>boring.log
VBoxManage convertfromraw disk.img disk.vdi --uuid '{4c2c12cf-ee32-4a37-afe9-8a4bd88abbca}' >>boring.log
echo done. starting vm
VBoxManage controlvm because poweroff >>boring.log
sleep 1
echo starting vm >>boring.log
VBoxManage startvm because >>boring.log
sleep 1
socat unix-connect:/tmp/foo stdout