OSDev.org
https://forum.osdev.org/

How to boot into nothing ?
https://forum.osdev.org/viewtopic.php?f=1&t=36940
Page 1 of 1

Author:  sweetpoision [ Mon Jun 29, 2020 7:38 am ]
Post subject:  How to boot into nothing ?

I am following a course which involves creating a simple kernel(as the instructor calls it) which I can run on a VM(virtualbox) and debugging using gdb(running on another VM - ubuntu) over serial port. The video tutorial shows use of these two files:

    memdisk
    floppy.img

after this
Code:
sudo mount temp/ /dev/sdb1/
command
the two files are copied to the temp/ directory .

There is also this command used :

Code:
sudo grub-install --root-directory temp/ /dev/sdb1/


The final result was: after placing this HardDisk(vhd) in a virtual machine, it should boot up to a screen like this :
Image

some gdb commands that the instructor runs on the Ubuntu VM (after the above screen has come up):

Code:
set debug remote 1
set remotebaud 38400
target remote /dev/ttyS0
c
load lab.out


further details:

The contents of menu.lst inside temp/boot/grub/:

Quote:
title GDB
root (hd0, 0)
####### The hdx part depends on the number of harddisks
####### you have. If you have one harddisk then the
####### memory stick would be hd1 and the entry will
####### be root (hd1, 0)
####### The second zero is actually dependent
####### on /dev/sda1. If it is sdaN the number will be
####### N-1

kernel /memdisk
initrd /floppy.img



contents of grub.cfg in temp/boot/grub/:

Quote:
set default=0 #assumes (hd0) to be default partition
set timeout=10 #the system will autoboot in 10 seconds
menuentry "GDB boot"{
linux16 /memdisk
initrd16 /floppy.img
boot
}


My questions:
1. What are those floppy.img and memdisk files and how can I aquire or create them ?
2. What is this kernel which sticks on
Quote:
booting...
called ?
3. How to boot into this nothing i.e just
Quote:
booting...
? How to achieve this so that I can load programs to this machine using gdb on another machine as mentioned above?

I tried creating a blank floppy.img using
Code:
mkfs.msdos -C myfloppy.img 1440
and also aquired memdisk from syslinux but didn't work

The reason I am asking this here is that the instructor did not provide links to download those files. Please bear with me and suggest a way using which I can accomplish the above.

Author:  Octocontrabass [ Tue Jun 30, 2020 2:14 pm ]
Post subject:  Re: How to boot into nothing ?

sweetpoision wrote:
1. What are those floppy.img and memdisk files and how can I aquire or create them ?

The "memdisk" file is part of Syslinux. You can download it from here. (But why not boot the floppy disk directly?)

The "floppy.img" file appears to be a floppy disk image containing a GDB stub and enough glue to make it boot, but I really have no way to know for sure.

sweetpoision wrote:
2. What is this kernel which sticks on
Quote:
booting...
called ?

"floppy.img" :wink:

sweetpoision wrote:
3. How to boot into this nothing i.e just
Quote:
booting...
? How to achieve this so that I can load programs to this machine using gdb on another machine as mentioned above?

Presumably you need a GDB stub and a wrapper of some sort to switch the CPU to protected mode and communicate over the serial port. I don't know if you need to implement any extra functionality to load your kernel through GDB remotely, I've never done that before!

sweetpoision wrote:
I tried creating a blank floppy.img using
Code:
mkfs.msdos -C myfloppy.img 1440
and also aquired memdisk from syslinux but didn't work

A blank floppy disk doesn't contain a GDB stub, but you should at least see MEMDISK display some text on the screen. If you're not even seeing the MEMDISK text, you haven't installed GRUB correctly on the hard disk image.

sweetpoision wrote:
The reason I am asking this here is that the instructor did not provide links to download those files. Please bear with me and suggest a way using which I can accomplish the above.

I suggest asking the instructor.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/