flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Real Mode FAT32 USB Boot Loader

Author
Thread Post new topic Reply to topic
Mike Gonta



Joined: 26 Dec 2010
Posts: 238
Location: the-ideom
Mike Gonta
The following code is a two part boot sector / boot loader, a File System Information sector and the first sector of the first FAT.
For simplicity, this is the minimum requirements for a FAT32 file system.
The second FAT is write only and will be created the first time the FAT is used. If the first root directory cluster (located after
the two FAT's - the size of which is based on the size of the UFD) is not blank garbage will appear in a directory listing. This
is why the UFD should be "quick formatted" FAT32 first.
This setup differs from the MS scheme which consists of the first sector of the two part boot sector (one sector is not large
enough for the code needed to load a named file from the root directory of FAT32). This is followed by the FSI sector and 4
blank sectors. Next is a copy of these 6 sectors followed by the second of the two part boot sector.


Last edited by Mike Gonta on 10 Jun 2013, 22:10; edited 8 times in total
Post 23 Mar 2011, 19:17
View user's profile Send private message Visit poster's website Reply with quote
Mike Gonta



Joined: 26 Dec 2010
Posts: 238
Location: the-ideom
Mike Gonta
The boot loader will load a plain text 8.3 format file name binary file from the FAT32 root directory to 0:600h. In order to
change the file name from the default Kernel.bin only a hex editor such as HxD is required. The file name is located
at offset 1F0h, can be mixed upper and lower case letters in 8.3 format and must be zero terminated.


Last edited by Mike Gonta on 17 Jul 2013, 09:47; edited 1 time in total
Post 24 Mar 2011, 23:39
View user's profile Send private message Visit poster's website Reply with quote
roboman



Joined: 03 Dec 2006
Posts: 122
Location: USA
roboman
Nice, that's right where I'm at, except with fat16. Been taking dd apart to see the details of how it works and making an attempt to learn fasm for windows, so I can do a utility that lists the usb flash drives and drops a bootsector like the above (selecting the right one for fat 32 or fat 16) on the usb flash drive. Dex did one and several others have managed it, so it can be done Smile
Post 25 Mar 2011, 03:42
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Nice work Mike Gonta, as the name is at a set offset, it would be simple to code a win console app that takes a name input, loads the .bin and up dates the .bin file name.

@roboman, I think the source for the usb4dex is included the zip (if not let me know), i like you, have very little experience with winasm coding, so the code is not the best.
But it will show you the function needed for low level disk read/write.

The code in the usb4dex is freeware and any ? just ask.
Post 25 Mar 2011, 16:25
View user's profile Send private message Reply with quote
roboman



Joined: 03 Dec 2006
Posts: 122
Location: USA
roboman
Do you mean http://dex-os.com/DownLoads/DexUsbBoot.zip, no source there ? I don't recall the file usb4dex.

The basics of it are to access the drive through the lower level device operations, right? I guess I could learn a bit more about windows by digging through this myself, but my interests have very little to do with the low level inner workings of windows. I just want to find or write a program that will be simple and install a usb flash drive boot loader that boots a named exe program on a flash drive. Maybe also copy the contents of a folder. Sort of a generic hobby os distribution tool for letting people load the os who aren't asm programmers and who aren't linux nuts. Something close to http://www.gocoding.com/page.php?al=bootflashdos

So, yes, it would be much appreciated if I could get those sources.
Post 26 Mar 2011, 21:31
View user's profile Send private message Visit poster's website Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Sorry i thought i included the source in that zip, you will find the code here:
http://dex-os.com/DownLoads/DexUSB.zip

I am working on a easier method, if it works i will let you know so you can use it.

[EDIT] Yes it seem to work, what you do is format the usb using HP format tool, click make bootable and point it to a folder that has your kernel in it (i think it need to be .sys) also you need a dummy command.com, so just name a txt file command.com and add it to the folder.
Click to format the fob, and if all goes well it should boot your kernel.
Post 26 Mar 2011, 23:40
View user's profile Send private message Reply with quote
nicks



Joined: 29 May 2012
Posts: 1
nicks
HI ..
I'ma beginner I have seen the code of the USB fat32 akernelloader bootloader

I tested on my machine and it works perfectly Very Happy Very Happy
this is the link http://code.google.com/p/akernelloader/
Post 29 May 2012, 17:36
View user's profile Send private message Reply with quote
asmdev



Joined: 21 Dec 2006
Posts: 18
asmdev
Hello, since everybody posting their fat32 code I though I'll drop by and include my version in the collection.

Has automatic detection of chs & lba. Caches a small portion of FAT (that's a table). And you can have 20 symbol error message. Fat32 must have 512bytes per sector and can have up to 32KB cluster.

Your up to 600KB file(default "12345678.bin") gets loaded at 0:8000h with FS equal to bios disk # (normally DL). DS:SI point to data structure which in turn points to the end of loaded file on disk.

GPL v2


Description:
Download
Filename: vbr_fat32_GPLv2_license.asm
Filesize: 7.64 KB
Downloaded: 295 Time(s)

Post 12 Jun 2012, 01:00
View user's profile Send private message 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.