flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Problem with booting or the kernel... not sure.

Author
Thread Post new topic Reply to topic
DragonFire



Joined: 07 Feb 2005
Posts: 13
DragonFire 08 Feb 2005, 00:01
Hello! I recently started developing an Operating System becuase it's something that I have always dreamed of doing.

Now, I "stole" some modified bootloader code from MeOS... it was just lying around on the forum and I figured I would try it out.

Now, the bootloader works great. It asks for the kernel filename, I type it in and the loader trys to boot the kernel.

But the problem is, it reboots the system. I included the zip file for the OS so if anyone can solve this please do.

Heres what I did. I compilied the files into .bin files using the FASM command line tool. Then, I used rawrite to write the BOOT.BIN file to a floppy and then I right clicked the KERNEL1.BIN file and clicked Send to Floppy.

To boot the kernel, you have to type KERNEL1.BIN (all caps) when it shows "PhasmaOS Kernel:". Then, hit ENTER (you may have to do it twice.).

Thanks!


Description: PhasmaOS Binary and Source
Download
Filename: PhasmaOS.zip
Filesize: 3.31 KB
Downloaded: 673 Time(s)

Post 08 Feb 2005, 00:01
View user's profile Send private message Reply with quote
jeffwilson



Joined: 06 Feb 2005
Posts: 10
jeffwilson 08 Feb 2005, 00:59
Just thought you'd like to know that your kernel is fine. This is definately an issue with the bootloader you are using. I copied KERNEL1.BIN to the first sector of a floppy image, and it booted quite well from qemu. Your bootloader freezes in QEMU; I hear BOCHS emulator has some pretty good debugging functions that will help you. Smile

-Jeff
Post 08 Feb 2005, 00:59
View user's profile Send private message Reply with quote
DragonFire



Joined: 07 Feb 2005
Posts: 13
DragonFire 08 Feb 2005, 02:06
Well, I never coppied the KERNEL to the first sector. Just the BOOT file. Should I have used Rawrite to copy he kernel file too?

BTW, i'll look at Bochs. Thanks for telling me. Very Happy
Post 08 Feb 2005, 02:06
View user's profile Send private message Reply with quote
DragonFire



Joined: 07 Feb 2005
Posts: 13
DragonFire 08 Feb 2005, 21:53
Ok. Sorry about double posting, but I can't download Bochs. Can some take a look at the bootloader's source and try and fix what's wrong?

Thanks!
Post 08 Feb 2005, 21:53
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio 08 Feb 2005, 23:18
You forget to put the kernel name in the boot sector
Post 08 Feb 2005, 23:18
View user's profile Send private message Visit poster's website Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 09 Feb 2005, 00:01
Do you pad the name to 12 bytes? If I remember correctly for FAT12 kernel1.bin would appear as: "kernel1 bin" (note the two spaces between "1" and "b".
Post 09 Feb 2005, 00:01
View user's profile Send private message Visit poster's website Reply with quote
DragonFire



Joined: 07 Feb 2005
Posts: 13
DragonFire 09 Feb 2005, 00:03
I'll look at the bootloader a bit harder and see if I missed something, but you type the name of the kernel to load when the bootloader starts. That way if you have a backup kernel, you can load it when the kernel1 gets corrupt.

EDIT: Whoops, i posted as crc was. I'm new to Assembly... so i'm not quite sure how to do that... or check if it's already done.
Post 09 Feb 2005, 00:03
View user's profile Send private message Reply with quote
asmdemon



Joined: 18 Jan 2004
Posts: 97
Location: Virginia Beach, VA
asmdemon 09 Feb 2005, 03:29
If i'm not mistaken, MEOS loads the kernel file to 1000:0000, hence the seg_read_kernel equ 01000h. In your kernel file, you have, "org 0x7C00". This is fine if you make your kernel file the boot sector, but if you want the MEOS boot sector, "BOOTMOSF", to be your boot sector, you will need an org of 0x0000 in your kernel1.bin file. Otherwise all the data and jmps will be to 1000:7C?? instead of 1000:00??.

EDIT: also, check out http://flatassembler.net/examples/phboot.zip.
I modified it slightly so you can compile and directly write it with a utility of your choice, or to load it directly into an emulator. Change the data in boot.asm to the following(instead of the XX data that exists on the original example):
Code:
;Modified by AsmDemon for direct placement onto floppy drive
;2004-10-18

        org     7C00h

FATSize         equ 6144                ;4096*1.5, max entries*entry size
RootSize        equ 512                 ;we'll read one sector (512b) at once

start:
        jmp     byte boot_code
        nop

b08_OEM         db 'MSDOS5.0'
wSecSize        dw 0x0200               ;always must be a multiplier of 32!
                                        ;(actually not used, 512b assumed)
bSecsPerCluster db 0x01                 ;number of sectors per one cluster
wResSecs        dw 0x0001               ;boot and reserved sectors
                                        ;also serves as data sector variable
bNumFATs        db 0x02                 ;number of FATs
wRootEntries    dw 0x00e0               ;number of root entries
wTotSecs        dw 0x0b40               ;total sectors
bMedia          db 0xf0                 ;"media descriptor", hehehe
wSecsPerFAT     dw 0x0009               ;number of sector occupied by one FAT
wSecsPerTrack   dw 0x0012               ;sectors per track, should be < 64!
wSidesPerTrack  dw 0x0002               ;number of sides
dHiddenSecs     dd 0x00000000           ;used only by DOS instead of MBR data
dBigTotSecs     dd 0x00000000           ;big total sectors (not used)
bDrive          db 0x00                 ;drive number, filled from BIOS
                db 0x00
bExtBootSig     db 0x29                 ;extended boot sector signature
dSerNum         dd 0xBA5EC0DE           ;serial number Smile
b11_VolumeLabel db 'DecafeLabel'        ;volume label, addition to ser.num.?
b08_FileSysID   db 'FAT12   '           ;completely unused FS signature...      
Post 09 Feb 2005, 03:29
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.