flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > bootstrap32 |
Author |
|
Mike Gonta 26 Apr 2012, 00:04
Unzip bootstrap32.zip inside your qemu folder.
Run the qemu.cmd. Code: @echo off set qemu=qemu-system-x86_64.exe if not exist %SystemRoot%\SysWOW64 set qemu=qemu.exe cd .. %qemu% -L . -localtime -hda bootstrap32\bootstrap32.img Last edited by Mike Gonta on 19 Nov 2012, 22:00; edited 3 times in total |
|||
26 Apr 2012, 00:04 |
|
Madis731 26 Apr 2012, 08:04
Its a nice bootstrap. You can build pretty much anything on top of that. All the hard work is done.
|
|||
26 Apr 2012, 08:04 |
|
Mike Gonta 26 Apr 2012, 23:23
Use this safe DD script to transfer bootstrap32 to a FAT32 formatted any size flash drive.
Code: @echo off echo Requires a non partitioned FAT32 formatted flash drive. set drive= set /p drive=bootstrap32 flash drive letter: set format=N set /p format=Do you want to format drive %drive%:? (Y/N) if not %format%==Y ( if not %format%==y ( goto :next ) ) dd\dd.exe --filter=removable if=/dev/zero od=%drive%: bs=512 count=1 2>NUL echo Remove and re-insert the flash drive. echo (Ignore Windows message to format the drive!) pause format %drive%: /FS:FAT32 /Q :next dd\dd.exe id=%drive%: of=temp bs=512 count=1 2>NUL dd\dd.exe if=bootstrap32.img of=temp bs=1 skip=48 seek=48 count=4 2>NUL dd\dd.exe if=bootstrap32.img of=temp bs=1 skip=90 seek=90 count=422 2>NUL dd\dd.exe if=bootstrap32.img of=temp bs=512 skip=1 seek=1 count=31 2>NUL dd\dd.exe --filter=removable if=/dev/zero od=%drive%: bs=512 count=1 2>NUL echo Remove and re-insert the flash drive. echo (Ignore Windows message to format the drive!) pause dd\dd.exe --filter=removable if=temp od=%drive%: 2>NUL del temp >NUL copy /Y root\*.* %drive%: pause Last edited by Mike Gonta on 19 Nov 2012, 22:01; edited 3 times in total |
|||
26 Apr 2012, 23:23 |
|
Mike Gonta 03 May 2012, 20:44
The bootstrap32 now uses the volume label (the directory entry in the root directory) to obtain the file name
of the loaded PM32 kernel file. The default file name can be easily changed to match your own without editing the boot sector as is commonly done. The volume label must be the same as the directory entry of the file. For example KERNEL.BIN would be: Code: KERNEL BIN
12345678123 extension with a maximum of 3 characters (no period). Last edited by Mike Gonta on 19 Nov 2012, 22:01; edited 1 time in total |
|||
03 May 2012, 20:44 |
|
hyperzap 17 May 2012, 07:12
Hey mike,
what would be the correct method of taking control of the PIT and its interrupt? Obviously, I need to use the timer interrupt yet I want the floppy BIOS calls to remain functional. Secondly, what tool do you use to create an image of the USB disk? running bootstrap32.cmd prepares the physical medium, but I would like to test using QEMU rather than hardware. Edit: Also this bootloader/bootstrap32.cmd does not work on my hardware. When booting with only the USB device connected, it errors, and if there is any other boot device connected (but on a lower boot order) it just boots that instead. Im not sure if that is due to my hardware, or a failure of bootstrap32.cmd |
|||
17 May 2012, 07:12 |
|
Mike Gonta 17 May 2012, 18:30
hyperzap wrote: what would be the correct method of taking control of the PIT and its interrupt? The protected mode interrupt descriptor table is located at address 1000h. Quote: Secondly, what tool do you use to create an image of the USB disk? Quote: running bootstrap32.cmd prepares the physical medium, but I would like to test using QEMU rather USB flash drive (even on a PC that will not natively boot from USB). Quote: Also this bootloader/bootstrap32.cmd does not work on my hardware. When booting with only the USB Drive read error! - This means that there was a failure (not likely) in the boot sector to read the flash drive. A20 line error - This means that the A20 line could not be set. Can't find the boot file - This message could occur in bootstrap32. If the file name is not specified it means that there is no volume name (which is used to identify the file to be loaded. This is easy to correct, merely change the volume name in Windows Explorer to match the name of the kernel file. On the other hand if there is a name specified it means that kernel file is not in the root directory, or doesn't have the same name, also easy to correct. Any other error message either originates in the original (formatted) boot sector or from the BIOS. This means that the process of injecting bootstrap32 failed. It is important to remove and re-insert the flash drive at the prompt (twice if the format option is selected). Quote: and if there is any other boot device connected (but on a lower boot order) it just boots that instead. the flash drive has not been properly prepared. A simple test would be to use HxD to transfer the bootstrap32.img to the flash drive. This will make the flash drive appear to be only 32.5 Mb but otherwise fully useable - just reformat to get the full capacity after testing. Last edited by Mike Gonta on 19 Nov 2012, 22:01; edited 1 time in total |
|||
17 May 2012, 18:30 |
|
flash 22 May 2012, 03:31
Hi Mike!
Can you post or make public the source code? I am interested in access usb drives from scratch. Thanks! |
|||
22 May 2012, 03:31 |
|
Dex4u 22 May 2012, 10:54
If your PC supports USB booting, you can use int 13h function to read/write to USB fob in realmode.
As soon as you move to PM emulation stops. So to read/write to USB fob from PM, you need to implement a usb stack or use some method to access real mode int 13h, in my OS for example, i switch beteen real and pmode, as soon as you go back to real mode USB read\write work again. Not sure about the inner workings of bootstrap32 |
|||
22 May 2012, 10:54 |
|
flash 22 May 2012, 18:38
Thank's Dex, I want to avoid BIOS usage, despite a bunch of technical documentation about USB interface i am not able to implement any working code to acces mass storage device... I am completely lost. Have you any example?
On the other hand... what drive number can be used al int 13h to point to usb device? Thank's again |
|||
22 May 2012, 18:38 |
|
Mike Gonta 22 May 2012, 21:18
flash wrote: I want to avoid BIOS usage the avoidance of 16bit real mode code that you are after. bootstrap32 allows full access to the BIOS in 32bit PM. The boot loader code is entirely PM32, in fact the only 16bit real mode setup code is in the boot sector itself. The entire loaded second stage of bootstrap32 is entirely PM32. This is the same as the "kernel" file loaded by bootstrap32. This is made possible by the BIOS extender in bootstrap32. flash wrote: what drive number can be used al int 13h to point to usb device? Last edited by Mike Gonta on 19 Nov 2012, 22:01; edited 1 time in total |
|||
22 May 2012, 21:18 |
|
Dex4u 23 May 2012, 11:34
flash wrote: Thank's Dex, I want to avoid BIOS usage, despite a bunch of technical documentation about USB interface i am not able to implement any working code to acces mass storage device... I am completely lost. Have you any example? Your better of using bootstrap32, because the work that is needed to code a usb stack is a lot, thats why a book has been written about it. But to your ?, some BIOS emulate has floppy, others has hdd, some both. So i have found it best to write for both, your boot code will be the same as for a floppy or hdd. (i use fat16 for hdd). Now i have done lots of tests and if you emulate has a floppy you must have a BPB at start (this does make a difference) . For hdd you can use with or without it. If you use floppy emulation, your usb fob will be 1.44MB in size (a quick format will fix that). Also best to use a BPB for hdd, than you can add file from win/linux in the normal way. You could do what menuetos does and load the whole floppy img into memory from unreal mode and than use the image as a vfile sys, than writing any changes when exiting OS by writing the vfile back to disk, back in unreal mode. |
|||
23 May 2012, 11:34 |
|
Mike Gonta 23 May 2012, 17:58
Dex4u wrote: Your better of using bootstrap32, because the work that is needed to code a usb stack is a lot, Hi Craig, Welcome to the mutual admiration society! It's easier to develop new code in a working environment. bootstrap32 will boot and run hobby OS kernels and standalone code. Last edited by Mike Gonta on 19 Nov 2012, 22:02; edited 1 time in total |
|||
23 May 2012, 17:58 |
|
Mike Gonta 09 Jun 2012, 18:55
bootstrap32 will now boot and run all three versions.
The bootstrap32 code is identical, the only difference is the Bios Parameter Block in the boot sector and the file system. Even the boot sector code is identical. Last edited by Mike Gonta on 19 Nov 2012, 22:02; edited 1 time in total |
|||
09 Jun 2012, 18:55 |
|
asmdev 10 Jun 2012, 18:54
Probably a good idea to get rid of A20 code from Fat32 VBR, and add support for LBA, and switch to reading disk one sector(512b) per one int13h call (for legacy reasons), and remove protected mode switch
Enough critics, I'll probably attach fat32 vbr of my own.
|
|||||||||||
10 Jun 2012, 18:54 |
|
Mike Gonta 10 Jun 2012, 19:23
asmdev wrote: Probably a good idea to get rid of A20 code from Fat32 VBR Modern PC's bootup with the A20 enabled, so it matters not whether it's FAT32, FAT16 or FAT12. For legacy purposes bootstrap32 has A20 code. It should be noted that all real mode setup code in bootstrap32 is in (and run from) the boot sector. The A20 code first checks if the A20 line is already enabled and only then if not enabled tries the 3 standard methods (BIOS int 15h, ax=2401h; port 92h and port 60h). asmdev wrote: and add support for LBA asmdev wrote: and switch to reading disk one sector(512b) per one int13h call (for legacy reasons) boot sector in one call, which means that it will cross to the other side of the first track of a legacy floppy disk (yes, bootstrap32 supports the legacy floppy drive), but only the most ancient of PC's will have trouble with this. asmdev wrote: and remove protected mode switch (which should be run in real mode), setting up and enabling identity mapped paging, and loading the GDT and changing to protected mode. Unlike other bootloaders, bootstrap32 is entirely PM32. This is made possible by the built in BIOS extender. bootstrap32 (and the user's loaded PM32 kernel) has full access to the native motherboard BIOS. It also means that I no longer have to write any real mode code. Need a memory map? - simply make the BIOS call in PM32. Read and write to the IPL USB flash drive? - no problem in PM32. Last edited by Mike Gonta on 19 Nov 2012, 22:02; edited 1 time in total |
|||
10 Jun 2012, 19:23 |
|
asmdev 10 Jun 2012, 21:18
I am just saying that you made all the mistakes that a beginner makes inside MBR or VBR. Especially when you have second stage bootloader.
|
|||
10 Jun 2012, 21:18 |
|
Mike Gonta 10 Jun 2012, 21:39
asmdev wrote: I am just saying that you made all the mistakes that a beginner makes inside MBR or VBR. Especially However, after 5 years of testing and development (and countless boot sectors) these same beginner mistakes are entirely by design. >>> No More Real Mode Code <<< is no mistake. It's only a legacy issue that the PC starts up in real mode. There's no reason why the PC can't startup in PM32 with BIOS access. Of course, that's the path taken by EUFI. There's no real mode code in the bootstrap32 boot loader. There's no real mode code in the loaded PM32 kernel. And this is only the beginning. Last edited by Mike Gonta on 19 Nov 2012, 22:03; edited 1 time in total |
|||
10 Jun 2012, 21:39 |
|
asmdev 10 Jun 2012, 22:14
You were embarrassing yourself during Your USB booting Quest because you didn't have enough computers. You are embarrassing yourself now. It's not in your interest to embarrass yourself for the 3rd time.
Quote: It's only a legacy issue that the PC starts up in real mode. There's no reason why the PC can't startup in PM32 |
|||
10 Jun 2012, 22:14 |
|
smiddy 13 Jun 2012, 16:35
It looks good Mike, thanks for sharing man!
|
|||
13 Jun 2012, 16:35 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.