diff --git a/disk_manager_utility.c b/disk_manager_utility.c index d661d00..73c1d8a 100644 --- a/disk_manager_utility.c +++ b/disk_manager_utility.c @@ -193,6 +193,19 @@ int main (int argc, char *argv[]) // Parse parameters for cmd usage switch(argv[i][1]) { + case 'd': + { + // Load disk with specified name + i++; // Go to next parameter which is the path/filename for the new disk + if (i > argc) + { + // Go to loop condition to exit + continue; + } + settings->load_diskname = argv[i]; + + } break; + case 'n': { // Create new disk @@ -247,6 +260,11 @@ int main (int argc, char *argv[]) } } + if (settings->new_diskname != NULL && settings->load_diskname != NULL) + { + printf("-d and -n cannot be specified in the same qeury\n"); + return 1; + } // Now execute the commands. // First check if we should create a new disk if (settings->new_diskname != NULL) @@ -273,7 +291,7 @@ int main (int argc, char *argv[]) { lsfs_disk_install_bootloader(settings->install_bootloader_path); } - sleep(1); + if (settings->install_vbr_path != NULL) { lsfs_disk_install_vbr(settings->install_vbr_path); diff --git a/lsfs_vbr/lsfs_16-bit b/lsfs_vbr/lsfs_16-bit index 7349805..0a6c743 160000 --- a/lsfs_vbr/lsfs_16-bit +++ b/lsfs_vbr/lsfs_16-bit @@ -1 +1 @@ -Subproject commit 73498055ec46bfa2290684b3a2129aebf1ee4f4a +Subproject commit 0a6c743d81cbd871eb40085ecae821965171fd38 diff --git a/lsfs_vbr/vbr_lsfs.nasm b/lsfs_vbr/vbr_lsfs.nasm index 213e916..df0b934 100644 --- a/lsfs_vbr/vbr_lsfs.nasm +++ b/lsfs_vbr/vbr_lsfs.nasm @@ -1,7 +1,7 @@ ORG 0x7c00 BITS 16 %define DISK_SERVICE 0x0050:0x0000 -%define KERNEL 0x2500:0x0000 ;0x0050:0x0512 +%define KERNEL 0x0150:0x0000 ;0x0050:0x0512 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Volume Boot Record ; This will start SingOS from the disk @@ -120,8 +120,15 @@ ext_disk_supported: mov dl, [global_disk_identifier] int 0x13 + mov cx, [vbr_LBA_FSCI] + mov WORD [Parameter_Struct.buffer_segment], 0x7e0 + mov WORD [Parameter_Struct.buffer_address], 0x2200 ; Heap memory start adresses for the file system + mov WORD [Parameter_Struct.buffer_size], 0xFFFF ; End address for the heap + mov WORD [Parameter_Struct.data_length], cx + mov bx, ds + mov cx, Parameter_Struct mov ax, 0x1 push cx push bx @@ -161,7 +168,7 @@ ext_disk_supported: ; Set the Parameter_Struct mov ax, kernel_path mov [Parameter_Struct.path], ax - mov WORD [Parameter_Struct.buffer_segment], 0x2500 + mov WORD [Parameter_Struct.buffer_segment], 0x0150 mov WORD [Parameter_Struct.buffer_address], 0x00 mov WORD [Parameter_Struct.buffer_size], 0xFFFF mov WORD [Parameter_Struct.byte_offset_into_file], 0x00 diff --git a/test/build.sh b/test/build.sh new file mode 100644 index 0000000..7d5e839 --- /dev/null +++ b/test/build.sh @@ -0,0 +1 @@ +nasm -fbin test_kernel.nasm -o kernel.bin diff --git a/test/test_kernel.nasm b/test/test_kernel.nasm new file mode 100644 index 0000000..25368b3 --- /dev/null +++ b/test/test_kernel.nasm @@ -0,0 +1,9 @@ +BITS 16 + ; ready to jump to the kernel + xor bx, bx + mov al, 0x49 + mov ah, 0x0E + int 0x10 + + cli + hlt \ No newline at end of file diff --git a/update_vbr.sh b/update_vbr.sh new file mode 100644 index 0000000..8ab7ced --- /dev/null +++ b/update_vbr.sh @@ -0,0 +1,6 @@ +set -e +cd lsfs_vbr/ +bash build.sh +cd .. +./disk_manager -d test.img -v lsfs_vbr/vbr.bin +qemu-system-x86_64 test.img \ No newline at end of file