'Debug' unformats floppy disk when writing bootloader to first sector - debugging

I am trying to write a very basic operating system in Assembly by following this video:
http://www.youtube.com/watch?v=6MJUGVFAXKg
My code is fine and has all been compiled to .bin files via NASM and, using a virtual machine running Windows XP, I have written the bootloder file to the (virtual) floppy using the 'debug' command, as per the video. This is all successful, and when I boot into the OS, it displays a 'kernel.bin file not found' error, which is expected becasue the kernel file wasn't on the floppy disk.
So I boot back into XP and try to copy the kernel.bin file to the floppy, but Windows tells me that the floppy is not formatted and asks me if I would like to format it. Obviously, once the disk is formatted, it is wiped, so it seems that I cannot have both the bootloader.bin and kernel.bin on the floppy at the same time.
How do I write other files to the disk as well as the bootloader?
You'll have to explain this in very simple terms; I'm an absolute beginner.
Thanks.

I fixed it. I downloaded someone else's bootloader which had a correctly functioning Boot Parameter Block. I must have made a mistake on the code on my own file which was preventing XP from recognising the disk as formatted. So it boots correctly now. Thanks so much for your input, Frank Kotler, I have definitely learnt something today and have a basic OS to call my own!

Related

Make a bootable USB program installer

I'm trying to make an installer for a program and for that program to work I need to alter a few important windows files
I'm trying to make it like this:
plug in the usb
boot from the usb
wait for the installer to finish
boot windows and taaada program installed
I used all kinds of variations of Ms-Dos to do this but all of them don't copy my program's files or fail at something else
Any idea how to make something similar ?
You could try NTFSDOS if you want to keep being in DOS, or you could use some Linux distribution and mount the harddrives partition that way.

How do I change the code in a FAT boot sector?

I am creating an operating system, and am able to create a simple multitasking kernel (though the code has been lost) and an IDE/ATA PIO driver without BIOS interrupts. I wish to create a boot loader that puts the system into Protected Mode, disables paging, creates a flat memory model, and then does a long jump to the 0x0 offset of a file named OS.SYS in the root directory of a FAT32 formatted hard drive. I know how do do everything except for one thing: change the boot sector of the disk. I know how to format a hard drive as FAT32 to get the correct BPB and such at the beginning of the file, but I do not know how to copy over the code so that the BPB is not corrupted. Even in Linux when DD was available, I was unable to overcome this hurdle - I always used a custom file system. I am now seeing the disadvantages to this, though, such as not being able to use simple tools like file managers to move files around for testing.
Basically, to sum it up, I'm asking how to change the boot sector code on an already working FAT32 file system without messing up the BPB.
Note: I am using Windows 10 and NASM, and intend to use virtual hard disks with QEMU or Virtualbox.

SD card Windows CE 6.0 for OMAP-L138

I have a problem to create a bootable SD-Card. I created my own OS-WinCE-6.0 using Platform Builder of Visual Studio 2005, I got the nk.bin file, I copied and pasted in the SD-Card. I need it to run on the board "OMAP-L138 ".
I tried to convert the .bin file to .nb0 file and do the same, I got the same problem.
unfortunately, when I turn on the board, nothing happen after, it doesn't start.
Please tell me what to do to solve this issue.
Thank you very much.
Youness
Probably SD-Card needs Boot-loader binary (EBOOT.nb0) to Make a bootable SD-card.
You need to partition the SD-card,
Flash NK.nb0 and EBOOT.nb0 using dd command from Linux PC, or if TI is providing any utility (such as cfimager.exe by freescale), you can use that.

Test assembly code on a mac

A while back I was following some tutorials an assembly. I was running it all on a windows machine, compiling with NASM and then writing the compiled code to a floppy disk, then reboot and try the code. This process was long and time consuming and sadly was not on a mac. When I found out that Xcode for mac installed NASM I immediately tried to compile some code. The code compiled fine. The issue is testing it. On a mac I have no floppy (not like I want to use one) so Im not sure how to test this. I looked in to Q (kju) and found it would only emulate things on an ISO file. So I guess what Im asking is is it possible to install the compiled code on an ISO file for testing? (Note: the code when compiled forms a .bin file)
Thanks for any help
I don't know exactly what you are trying to test (a boot loader maybe?) but you don't need to reboot or boot from a disk just to run assembled code (unless it is a boot loader or something).
Either way, if you need to "reboot" to test, I suggest running an emulator. Sun VirtualBox is super easy to use and free and emulates a standard x86 architecture (including floppy drives)! So that may work for you in the short term. If you ever want to create an ISO image in the future, you can do that with the command line utility hdiutil. In a terminal window, type man hdiutil or visit the online man page for more information on using that to create all kinds of disk images.

How to use OpenEmbedded generated images

I installed openembedded and tried building a couple of images for Zaurus SL-6000 "Tosa", basically, helloworld-image and console-image. And I ended up with an angstrom-dev/deploy/glibc/images/tosa directory that contains files like this (slightly truncated from a forum post I made elsewhere):
Angstrom-helloworld-image-glibc-ipk-2009.X-test-20090529-tosa-installkit.tgz
Angstrom-helloworld-image-glibc-ipk-2009.X-test-20090529-tosa.rootfs.jffs2
Angstrom-helloworld-image-glibc-ipk-2009.X-test-20090529-tosa.rootfs.tar.bz2
Angstrom-helloworld-image-glibc-ipk-2009.X-test-20090529-tosa.rootfs.tar.gz
helloworld-image-tosa.tar.bz2
helloworld-image-tosa.tar.gz
initramfs-kexecboot-image-tosa.cpio.gz
initramfs-kexecboot-image-tosa.jffs2
initramfs-kexecboot-image-tosa.tar.bz2
initramfs-kexecboot-image-tosa.tar.gz
modules-2.6.29-r0-tosa.tgz
updater.sh.tosa
zImage-2.6.29-r0-tosa.bin
zImage-kexecboot-2.6.24-r0-tosa.bin
zImage-kexecboot-tosa.bin
zImage-tosa.bin
I have no idea what all these do or how to install them properly. What I did try is various combinations of flashing a zImage.bin and initrd.bin using option 4 of the maintenance menu (as specified per earlier instructions). The flashing usually works alright but then when it boots, it loads a bootloader that cannot find any bootable devices. On a hunch, I tried unpacking one of the tar.gz images to an ext2 formatted SD card and tried booting with that plugged in and it was detected by the bootloader. Booting it sort of worked but it quickly exited back to the bootloader (I assume that was just a problem with the image I unpacked).
My questions are:
What is the correct usage for all of these file types, i.e. should the .jffs2 files be renamed initrd.bin and included in the flashing process? What am I supposed to do with the bz2 and gz files? Are they only for unpacking to external media?
How do I install to the internal flash? It used to work with the stable Angstrom 2007-12 build and instructions.
Is there a newer version of updater.sh (that one was not built by oe and I added it myself having picked it up from elsewhere)? The reason I ask is that when trying to flash zImage-2.6.29-r0-tosa.bin it fails during the update program with the error that the file is too big. That kernel is approximately 1.3mb while the others are 1.2mb. Is this a constraint of the SL-6000 itself? I thought it has 32mb of internal memory.
Unfortunately, none of the available documentation that I could find online talks about installing these files. I did find a small entry in the "Angstrom Manual" which talks about what they are but not how to use them as they are all device specific. Unfortunately the tosa documentation only talks about copying the files from an installkit and flashing the device from the maintenance menu.
Okay, "ant" over at OE forums was able to answer my questions ^^ Just recording the answer here for posterity.
installkit-tosa.tar.gz, contains updater.sh and zImage (the kexecboot-kernel). This kexecboot-kernel can be and is likely different from the kernel you will have on the rootfs after the machine boots. Unpack the installkit on a formatted card and follow the flashing procedure for the device.
Regarding the also be various image-rootfs.tar.gz, .bz2, and .jffs2 files. These are the root file systems that will be be booted by kexecboot. The tar.gz or .bz2 archive should be unpacked onto an ext2 (or possibly ext3) formatted SD or CF card. It will be detected by kexecboot at boot time and appear in the kexecboot menu.
If you want a rootfs in nand (installed internally), rename your-image-rootfs.jffs2 to initrd.bin and copy it on the card with updater.sh (then flash).

Resources