Newbie question about installation of pistachio

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
shogun1234
Posts: 7
Joined: Sat May 17, 2008 10:10 am

Newbie question about installation of pistachio

Post by shogun1234 »

I follow the page at http://l4ka.org/projects/pistachio/ia32 ... tarted.php, trying to install pistachio with qemu. During compilation, there is no error message thrown out. However, the problem occurred whilst booting floppy image with qemu. The qemu screen simply stays at "grub> _" without going further. What should I do so that grub will boot the pistachio kernel?

The stage I follow includes

Stage 1 -> Stage 2 -> Create disk image (no root privileges required) -> finally exec `qemu -fda fdimage.img` to boot pistachio.

It looks like the qemu does not load the kernel image because in grub> I try to exec command `boot', it shows `Error 8: Kernel must be loaded before booting.' ; unfortunately, I do not know how to fix this problem.

Would anyone please give me suggestion on this?

I appreciate any help.

Thank you very much.



The config file (I only use default setting)

Code: Select all

#
# Automatically generated, don't edit
#
# Generated on: zion
# At: Mon, 10 Aug 2009 21:57:00 +0000
# Linux version 2.6.30-1-686-bigmem (Debian 2.6.30-5) ([email protected]) (gcc version 4.3.3 (Debian 4.3.3-15) ) #1 SMP Mon Aug 3 17:32:39 UTC 2009

#
# Pistachio Kernel Configuration System
#

#
# Hardware
#

#
# Basic Architecture
#
CONFIG_ARCH_X86=y
CONFIG_ARCH_POWERPC=n
CONFIG_ARCH_POWERPC64=n


#
# X86 Processor Architecture
#
CONFIG_SUBARCH_X32=y
CONFIG_SUBARCH_X64=n


#
# Processor Type
#
CONFIG_CPU_X86_I486=n
CONFIG_CPU_X86_I586=y
CONFIG_CPU_X86_I686=n
CONFIG_CPU_X86_P4=n
CONFIG_CPU_X86_K8=n
CONFIG_CPU_X86_C3=n
CONFIG_CPU_X86_SIMICS=n


#
# Platform
#
CONFIG_PLAT_PC99=y

CONFIG_SMP=n

#
# Miscellaneous
#
CONFIG_IOAPIC=n



#
# Kernel
#
CONFIG_IPC_FASTPATH=n
CONFIG_DEBUG=n
CONFIG_DEBUG_SYMBOLS=n
CONFIG_EXPERIMENTAL=n
CONFIG_PERFMON=n
CONFIG_SPIN_WHEELS=n
CONFIG_NEW_MDB=n
CONFIG_X86_SMALL_SPACES=n


#
# Debugger
#
CONFIG_KDB=n

#
# Consoles
#
CONFIG_KDB_CONS_OF1275=n
CONFIG_KDB_CONS_PSIM_COM=n


#
# Kernel Debugger Console
#
CONFIG_KDB_CONS_KBD=n
CONFIG_KDB_CONS_COM=n

CONFIG_KDB_DISAS=n
CONFIG_KDB_ON_STARTUP=n
CONFIG_KDB_BREAKIN=n
CONFIG_KDB_BREAKIN_BREAK=n
CONFIG_KDB_BREAKIN_ESCAPE=n
CONFIG_KDB_INPUT_HLT=n
CONFIG_KDB_NO_ASSERTS=n

#
# Trace Settings
#
CONFIG_VERBOSE_INIT=n
CONFIG_TRACEPOINTS=n
CONFIG_KMEM_TRACE=n
CONFIG_TRACEBUFFER=n



#
# Code Generator Options
#


#
# Derived symbols
#
CONFIG_HAVE_MEMORY_CONTROL=n
CONFIG_X86_PSE=y
CONFIG_BIGENDIAN=n
CONFIG_X86_SYSENTER=n
CONFIG_X86_PGE=n
CONFIG_X86_FXSR=n
CONFIG_IS_32BIT=y
CONFIG_X86_HTT=n
CONFIG_X86_PAT=n
CONFIG_IS_64BIT=n
CONFIG_MULTI_ARCHITECTURE=n
CONFIG_X86_EM64T=n
CONFIG_X86_SMALL_SPACES_GLOBAL=n
CONFIG_X86_TSC=y
#
# That's all, folks!
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: Newbie question about installation of pistachio

Post by gravaera »

17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
shogun1234
Posts: 7
Joined: Sat May 17, 2008 10:10 am

Re: Newbie question about installation of pistachio

Post by shogun1234 »

I follow the wiki and run the example code. It has the same result as launching pistachio image. I check the pistachio image and am sure that the grub.conf exists as the following location show.

/boot/grub/grub.conf
/boot/grub/stage1
/boot/grub/stage2
/kickstart
/pingpong
/sigma0
/x86-kernel

Is this file structure correct?

And the content of the grub.conf is

root (fd0,0)
default=0
timeout=10
# serial --port=0x3f8 --speed=115200
# terminal --timeout=0 serial
title L4Ka::pistachio
kernel /kickstart
module /x86-kernel
module /sigma0
module /pingpong

Thanks for the reply.

I really appreciate your help.
User avatar
AndrewAPrice
Member
Member
Posts: 2327
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Newbie question about installation of pistachio

Post by AndrewAPrice »

shogun1234 wrote: Is this file structure correct?
Yes. You can move the files to any location you want, as long as you update your GRUB configuration (which is correct for where the files are now).
My OS is Perception.
shogun1234
Posts: 7
Joined: Sat May 17, 2008 10:10 am

Re: Newbie question about installation of pistachio

Post by shogun1234 »

MessiahAndrw wrote:
shogun1234 wrote: Is this file structure correct?
Yes. You can move the files to any location you want, as long as you update your GRUB configuration (which is correct for where the files are now).
After checking again the wiki (http://wiki.osdev.org/Bare_Bones#Starti ... .2FQEMU.29), I still can not get the qemu to boot using kernel image described in the wiki page. I think I may miss something but I am not aware of it.

Following is the procedure I use to compile the code, create floppy image; then booting with qemu `qemu -fda floopy.img` Code is the same as wiki. Is it correct?

as -o loader.o loader.s
gcc -o kernel.o -c kernel.c -Wall -Wextra -nostdlib -nostartfiles -nodefaultlibs
#-Werror
ld -T linker.ld -o kernel.bin loader.o kernel.o
dd if=/dev/zero of=pad bs=1 count=750
cat boot/grub/stage1 boot/grub/stage2 boot/grub/grub.conf boot/grub/menu.lst pad kernel.bin > floppy.img # linux, netbsd, ..

Thanks for help.
User avatar
AndrewAPrice
Member
Member
Posts: 2327
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: Newbie question about installation of pistachio

Post by AndrewAPrice »

Can you please explain your problem in more detail than "I still can not get the qemu to boot using kernel image"?

Does qemu itself give an error? Does GRUB give an error?
My OS is Perception.
User avatar
Velko
Member
Member
Posts: 153
Joined: Fri Oct 03, 2008 4:13 am
Location: Ogre, Latvia, EU

Re: Newbie question about installation of pistachio

Post by Velko »

shogun1234 wrote:cat boot/grub/stage1 boot/grub/stage2 boot/grub/grub.conf boot/grub/menu.lst pad kernel.bin > floppy.img # linux, netbsd, ..
There's your problem. You created a floppy image with no filesystem on it. GRUB has no idea where your grub.conf, nor everything else is located.

I suggest to create a floppy image with proper filesystem. Here's how (on Linux, requires root privileges most of the time):

Code: Select all

dd if=/dev/zero of=floppy.img bs=1024 count=1440
losetup /dev/loop0 floppy.img
mkfs.vfat /dev/loop0
mount /dev/loop0 /mnt
mkdir -p /mnt/boot/grub
cp stage1 stage2 fat_stage1_5 menu.lst /mnt/boot/grub/
# copy whatever other files you need into /mnt
umount /mnt
losetup -d /dev/loop0
grub --device-map=/dev/null
device (fd0) floppy.img
root (fd0)
setup (fd0)
quit
There, now you have a bootable floppy image with FAT filesystem.

Note: I suggest to rename your grub.conf to menu.lst as it is the file name (at least Debian's) GRUB uses by default.

Later, when you need to modify something in your floppy image (new files or somehing), just mount it with

Code: Select all

mount floppy.img /mnt -o loop
and do there whatever you want. Don't forget to umount it after you're done.

Sidenote: Could somebody update Wiki? I've seen several newbies tripping on this.
If something looks overcomplicated, most likely it is.
shogun1234
Posts: 7
Joined: Sat May 17, 2008 10:10 am

Re: Newbie question about installation of pistachio

Post by shogun1234 »

Thanks you very much. This does really help!

The problem is that there is no file system on the floppy image and I complately was not aware of it.

Now I am able to boot the floppy.img using qemu by command `qemu -fda floppy.img`

And the script to do grub install

Code: Select all

cat <<EOF | sudo /usr/sbin/grub --device-map=/dev/null
device (fd0) floppy.img
root (fd0)
setup (fd0)
quit
EOF
and the menu.lst is

Code: Select all

root (fd0,0)
default=0
timeout=10
# serial --port=0x3f8 --speed=115200
# terminal --timeout=0 serial
title osdev kernel
        kernel /kernel.bin
I am not very sure why when using menu.lst copied from /boot/grub/menu.lst, the qemu would complain something like `can not recognize device string'. But basically the above menu.lst (from pistachio getting started document) would just work.

And after qemu booting, the screen would show

Code: Select all

A booting 'osdev kernel'

kernel /kernel.bin
    Multiboot-elf, <0x100000:0x43:0x401d>, shtab=0x105118,entry=0x1000c
Thanks again for all your help.

I really appreciate it.
Velko wrote:
shogun1234 wrote:cat boot/grub/stage1 boot/grub/stage2 boot/grub/grub.conf boot/grub/menu.lst pad kernel.bin > floppy.img # linux, netbsd, ..
There's your problem. You created a floppy image with no filesystem on it. GRUB has no idea where your grub.conf, nor everything else is located.

I suggest to create a floppy image with proper filesystem. Here's how (on Linux, requires root privileges most of the time):

Code: Select all

dd if=/dev/zero of=floppy.img bs=1024 count=1440
losetup /dev/loop0 floppy.img
mkfs.vfat /dev/loop0
mount /dev/loop0 /mnt
mkdir -p /mnt/boot/grub
cp stage1 stage2 fat_stage1_5 menu.lst /mnt/boot/grub/
# copy whatever other files you need into /mnt
umount /mnt
losetup -d /dev/loop0
grub --device-map=/dev/null
device (fd0) floppy.img
root (fd0)
setup (fd0)
quit
There, now you have a bootable floppy image with FAT filesystem.

Note: I suggest to rename your grub.conf to menu.lst as it is the file name (at least Debian's) GRUB uses by default.

Later, when you need to modify something in your floppy image (new files or somehing), just mount it with

Code: Select all

mount floppy.img /mnt -o loop
and do there whatever you want. Don't forget to umount it after you're done.

Sidenote: Could somebody update Wiki? I've seen several newbies tripping on this.
shogun1234
Posts: 7
Joined: Sat May 17, 2008 10:10 am

Re: Newbie question about installation of pistachio

Post by shogun1234 »

MessiahAndrw wrote:Can you please explain your problem in more detail than "I still can not get the qemu to boot using kernel image"?

Does qemu itself give an error? Does GRUB give an error?
Thanks for your reply.

Sorry I did not know that it is file system problem on floppy image; and when booting using that broken floppy.img, the console (terminal) and qemu did not show anything wrong.

Thanks for your help.
Post Reply