How to boot into nothing ?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
sweetpoision
Posts: 1
Joined: Mon Jun 29, 2020 7:17 am
Libera.chat IRC: sweetpoision

How to boot into nothing ?

Post by sweetpoision »

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: Select all

sudo mount temp/ /dev/sdb1/
command
the two files are copied to the temp/ directory .

There is also this command used :

Code: Select all

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: Select all

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/:
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/:
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
booting...
called ?
3. How to boot into this nothing i.e just
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: Select all

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.
Octocontrabass
Member
Member
Posts: 5575
Joined: Mon Mar 25, 2013 7:01 pm

Re: How to boot into nothing ?

Post by Octocontrabass »

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
booting...
called ?
"floppy.img" :wink:
sweetpoision wrote:3. How to boot into this nothing i.e just
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: Select all

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.
Post Reply