-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
45ab08f
commit c9b1a34
Showing
69 changed files
with
677 additions
and
4,321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,57 @@ | ||
|
||
override FLP = os1.img | ||
override ISO = os1.iso | ||
override BINS := $(shell find ./ -type f -name '*.bin') | ||
override FD_IMG := img/disk.img | ||
override CD_IMG := img/disk.iso | ||
|
||
.PHONY:all | ||
all: load kern binary disk run | ||
override OS_BIN := bin/os.sys | ||
|
||
# | ||
# Builds the LOAD (bootloader) | ||
load: | ||
make -C boot | ||
override BOOT_FILE := bin/boot.sys | ||
override KERN_FILE := bin/kernel.sys | ||
|
||
# | ||
# Builds the main kernel (called Copland) | ||
kern: | ||
make -C kernel | ||
.PHONY: all boot kernel | ||
all: boot kernel disk run | ||
|
||
# | ||
# Create a system binary by combining nload.bin & kernel.bin | ||
binary: | ||
cat bin/boot.bin bin/kernel.bin > bin/os1.bin | ||
# | ||
# Creates a low density 360 KiB | ||
disk: load kernel binary | ||
dd if=/dev/zero of=img/$(FLP) bs=512 count=720 | ||
dd if=bin/os1.bin of=img/$(FLP) conv=notrunc | ||
boot: | ||
make -f boot/boot.mk | ||
|
||
kernel: | ||
make -f kernel/kernel.mk | ||
|
||
# | ||
# Create high density 1.44M floppy image (needed for CD-ISO) | ||
144img: | ||
dd if=/dev/zero of=img/$(FLP) bs=512 count=2880 | ||
dd if=bin/os1.bin of=img/$(FLP) conv=notrunc | ||
# Double Density 3.5" 720KiB disks | ||
# | ||
disk: | ||
dd if=/dev/zero of=$(FD_IMG) bs=512 count=1440 | ||
dd if=$(BOOT_FILE) of=$(FD_IMG) bs=512 count=1 conv=notrunc | ||
dd if=$(KERN_FILE) of=$(FD_IMG) bs=512 seek=1 conv=notrunc | ||
|
||
# | ||
# Creates an ISO image | ||
cdiso: 144img | ||
mkisofs -quiet -V 'os1-ar-510' -input-charset iso8859-1 -o img/$(ISO) -b $(FLP) img/ | ||
# CD ISO - uses high density 1.44MB disk image | ||
# | ||
# Runs the os1.img in QEMU | ||
run: disk | ||
qemu-system-i386 -fda img/$(FLP) | ||
cdrom: base | ||
dd if=/dev/zero of=$(FD_IMG) bs=512 count=2880 | ||
dd if=$(BOOT_FILE) of=$(FD_IMG) bs=512 count=1 conv=notrunc | ||
dd if=$(KERN_FILE) of=$(FD_IMG) bs=512 seek=1 conv=notrunc | ||
|
||
# | ||
# Run the CD-ISO image (os1.iso) - QEMU | ||
runcd: cdiso | ||
qemu-system-i386 -cdrom img/$(ISO) | ||
mkisofs -quiet -V 'honolulu' \ | ||
-input-charset iso8859-1 \ | ||
-o img/disk.iso \ | ||
-b disk.img \ | ||
img | ||
|
||
run: | ||
qemu-system-i386 -fda $(FD_IMG) | ||
|
||
run-cd: cdrom | ||
qemu-system-i386 -cdrom $(CD_IMG) | ||
|
||
utils: | ||
make -f utils/utils.mk | ||
|
||
.PHONY: clean | ||
clean: | ||
make -C boot clean | ||
make -C kernel clean | ||
make -C pinboard clean | ||
rm $(BINS) img/$(FLP) img/$(ISO) | ||
make -f boot/boot.mk clean | ||
make -f kernel/kernel.mk clean | ||
make -f utils/utils.mk clean | ||
|
||
rm $(FD_IMG) | ||
rm $(CD_IMG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
Operating System/1 Average Release 5.2.1 | ||
Operating System/1 Average Release 5.3.0 | ||
================================================ | ||
|
||
Changes: | ||
- trigger kernel panic from MP | ||
- partial working BBFS driver (read only) | ||
for more info check kernel/fs/bbfs/bbfs.txt | ||
|
||
- changes to the Makefiles |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
|
||
# Change as you like but keep it x86 compatable. | ||
ARCH=i386-elf | ||
|
||
AS=$(ARCH)-as | ||
LD=$(ARCH)-ld | ||
|
||
override BIN := ../bin/boot.bin | ||
override ASM := $(shell find ./ -type f -name '*.S') | ||
override BIN := ./bin/boot.sys | ||
override ASM := $(shell find ./boot -type f -name '*.S') | ||
override OBJ := $(ASM:.S=.o) | ||
|
||
.PHONY: all | ||
all: $(BIN) | ||
|
||
$(BIN): $(OBJ) | ||
$(LD) -Tx86.ld $(OBJ) -o $@ | ||
$(LD) -Tboot/x86.ld $(OBJ) -o $@ | ||
|
||
%.o: %.S | ||
$(AS) $< -o $@ | ||
|
||
.PHONY: clean | ||
clean: | ||
rm $(OBJ) | ||
rm $(BIN) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,17 @@ | ||
|
||
.code16 | ||
.global read_disk | ||
.global _print | ||
.section .text | ||
.extern STAGE2 | ||
.global _dev | ||
_print: | ||
lodsb | ||
|
||
read_disk: | ||
clc | ||
incb (trys) | ||
or %al, %al | ||
jz .p_done | ||
|
||
mov $0x02, %ah # Read disk arg. (ah = 0x02) | ||
mov $0x40, %al # Number of sectors to read (64) | ||
mov $0x7e00,%bx # Buffer address (2nd sector) | ||
mov $0x00, %ch # Track / Cylinder number | ||
mov $0x02, %cl # Sector number | ||
mov $0x00, %dh # Head number | ||
movb (_dev), %dl # Disk drive (0 - drive A; 1 - drive B) | ||
|
||
int $0x13 # Disk interrupt (0x13) | ||
|
||
jc disk_error # If clear flag is set jump to disk_error | ||
|
||
ret # Return | ||
|
||
disk_info: | ||
|
||
disk_error: | ||
clc | ||
cmpb $3, (trys) # If num of tries is less than 3 | ||
jl read_disk # jump to read_disk | ||
|
||
mov $0x03, %ax # Clear the screen | ||
mov $0x0e, %ah | ||
int $0x10 | ||
|
||
mov $0x13, %ah # Value 0x13 (print str.) | ||
mov $0x01, %al # String type | ||
mov $0x00, %bh # Video page num. | ||
mov $0x0c, %bl # Attribute (L. Red on Black) | ||
mov $38, %cx # String len. = 38 chars. | ||
mov $0x00, %dh # Row 1 | ||
mov $0x00, %dl # Column 0 | ||
mov $_err0, %bp # String to print | ||
int $0x10 # Call interrupt | ||
|
||
cli | ||
hlt | ||
|
||
.section .rodata | ||
_err0: .asciz "/!\\ Disk read error, system halted /!\\" | ||
jmp _print | ||
|
||
.section .data | ||
# Disk read | ||
trys: .byte 0 | ||
_dev: .byte 0 | ||
.p_done: | ||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,101 @@ | ||
|
||
.code16 | ||
.global _stage1 | ||
.section .text.s1 | ||
.set STAGE2, 0x7e00 | ||
.global STAGE2 | ||
.extern _dev | ||
.section .text | ||
.global _entry | ||
|
||
_stage1: # Bootloader entry point | ||
.extern _printk | ||
|
||
/* | ||
* Entry point (for the linker) | ||
*/ | ||
_entry: | ||
jmp _start # Jump over the BBFS | ||
nop | ||
|
||
movb %dl, _dev # Boot device value | ||
/* | ||
* Bad Block File System | ||
* Parameters | ||
* | ||
* as defined in BBFS specification | ||
*/ | ||
_disk_label: .asciz "OS1 BOOT" # Disk label, 8 bytes | ||
_block_size: .byte 5 # size of the blocks | ||
_reserved: .word 0 # 2 bytes of reserve | ||
_bootable: .byte 1 # Bootable: 1-yes, 0-no | ||
_file_sys: .asciz "BBFS V01" # File system str. 8 chars. | ||
|
||
xor %ax, %ax | ||
mov %ax, %ds | ||
mov %ax, %ss | ||
mov $_stage1,%sp | ||
cld | ||
/* | ||
* Main bootloader function | ||
*/ | ||
_start: | ||
movb %dl, _bd # Save boot device num. | ||
|
||
mov $0x03, %ax | ||
int $0x10 | ||
|
||
/* First part of the boot msg. */ | ||
mov $0x03, %ax # Clear the screen | ||
# Set pallete register | ||
mov $0x1003,%ax | ||
mov $0x00, %bl | ||
int $0x10 | ||
|
||
mov $0x13, %ah # Value 0x13 (print str.) | ||
mov $0x01, %al # String type | ||
mov $0x00, %bh # Video page num. | ||
mov $0x0f, %bl # Attribute (White on Black) | ||
mov $0x04, %cx # String len. = 4 chars. | ||
mov $0x00, %dh # Row 0 | ||
mov $0x00, %dl # Column 0 | ||
mov $_msg0, %bp # String to print | ||
int $0x10 # Call interrupt | ||
# Set up the font | ||
mov $0x11, %ah | ||
mov $0x11, %al | ||
int $0x10 | ||
|
||
# | ||
# Stack setup | ||
# | ||
cli | ||
mov $0x9000,%ax | ||
mov %ax, %ss | ||
mov $0xF800,%sp | ||
sti | ||
|
||
# Print boot msg. | ||
mov $_sm, %si | ||
call _print | ||
|
||
call read_disk | ||
/* | ||
* Read kernel func. | ||
* | ||
* reads 128 sectors. | ||
*/ | ||
_disk_read: | ||
|
||
xor %ax, %ax | ||
mov %ax, %es | ||
|
||
mov $0x02, %ah | ||
mov $0x40, %al | ||
mov $0x7e00,%bx | ||
mov $0x00, %ch | ||
mov $0x02, %cl | ||
mov $0x00, %dh | ||
movb (_bd), %dl | ||
|
||
int $0x13 | ||
|
||
jc _disk_error | ||
|
||
mov $_ok, %si | ||
call _print | ||
|
||
jmp 0x7e00 | ||
|
||
.section .rodata # Read-only data | ||
_msg0: .asciz "\xDB\xDB\xDB " # Boot message (1/2). | ||
_disk_error: | ||
mov $_er, %si | ||
call _print | ||
|
||
_end: | ||
cli | ||
hlt | ||
|
||
.section .rodata | ||
_sm: .asciz "Booting..." | ||
_ok: .asciz "\r\nLoaded." | ||
_pc: .asciz "\r\nPassing control to the kernel...\r\n" | ||
_er: .asciz "\r\nDisk read error!" | ||
|
||
.section .data | ||
_bd: .byte 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
mkdir bin | ||
mkdir img |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.