Success! Jnode 0.2.5 booting from Harddisk and EXT2
After a lot of trial and error, and far too many false starts, I have finally successfully built a Jnode 0.2.5 PC which boots and runs from an EXT2-formatted filesystem mounted read/wrote from the harddisk, without CDROM or USB support.
And I still have 14GB of free disk space to use for builds and testing.
Details after the break...
--- Hardware ---
I assembled a bunch of spare parts laying around into a testbed machine.
CPU: 2 x Pentium III 500MHz
Motherboard: SuperMicro P6DGU
RAM: 2 x 256MB and 2 x 128MB - 768 MB total
Video: STB Systems/NVidia Riva TNT 1.10 16MB
Network: Intel EtherExpress Pro 100
Hard disk: Seagate ST315320 IDE 15GB
PS2 Keyboard, Logitech wheel mouse, and XVGA monitor to round things out.
--- ! USB ---
The BIOS version in the SuperMicro motherboard I have doesn't support USB booting.
If it did, this whole thing would have probably been MUCH easier, and was the first thing I tried.
No luck, so I had to roll the filesystem the hard way.
Plus, I learned a lot more and got the gigs and gigs of writable space to experiment with that I wanted anyway.
--- The Roadmap ---
1. Download Jnode 0.2.5 ISO and sources to a workdir.
2. Run build.sh x86 cd-x86-lite javadoc check-plugins
This gave me the all/build/x86/32bits/bootdisk pieces I needed.
To build the hardware, I went through all/build/descriptors/*.xml to find the PCI ID numbers for each device supported.
From a Fedora rescue CD, I swapped parts around and used lspci to identify the PCI IDs for various spares here.
Once I had a video card and NIC with a supported PCI ID, I test booted from the Jnode ISO to make sure things worked as expected.
--- Boot Disk? ---
Once I was certain the hardware could at least minimimally do the job, I thought it would be a short step to a bootable Jnode hard drive.
Alas, the boot drive turned out to be the biggest stumbling block, as you can see from my posts a couple of months ago trying this with Jnode 0.2.4.
Over the past few days, I found some time and inclination to return to this part and finally got things working.
--- Filesystem Flavor? ---
First, I have no good experience with FAT32/VFAT/YAFAT and all of the bewildering partition types, Windows versions necessary, etc.
I also couldn't make heads or tails out of how to build a FAT filesystem that would be usable for Jnode, under Fedora.
So, a VFAT/FAT32 or whatever really wasn't an option for me.
As a long-time Unix/Linux victim, EXT2 seemed the way to go.
But, for the life of me, I could NOT get Jnode to recognize most EXT2 disks I built.
That's where I left everything under Jnode 0.2.4.
I could boot and run from ISO and in VMware, but that's all.
If Jnode recognized the EXT2 filesystem, it would complain about the LARGE_FILES filesystem option, and mount the filesystem as read-only.
Then my day job exploded in my face and I haven't had time or energy to even think about a fun project like Jnode.
--- Return To Bootlandia ---
Things at work have wound down enough to return to looking at this.
As I got back into Jnode and picked back up where I left off months ago, I decided to start over with a fresh Jnode 0.2.5 build directory and everything, and work through the problem.
Once I was sure my system would build Jnode 0.2.5, it was time to plan the attack.
I went into the JNode-FS source and mapped out which exact EXT2 options were supported.
The fs/src/fs/org/jnode/fs/ext2/ directory had everything I needed.
Specifically, SuperBlock.java, Inode.Java and Ext2Constants.java lead me to the following specific EXT2 configuration as "supported":
4096 bytes-per-inode, 5% reserved blocks ratio, sparse superblocks option, no filetype option, no large_files option, max mount_count 255, max mount_interval 365 days, revision 1, OS value 42, and inode size of 128.
Normally, the Linux commands to create that exact filesystem would be:
# mkfs.ext2 -i 4096 -L JNODE025 -m 5 -O sparse_super -r 1 -o 42 -I 128 /dev/hdX
# tune2fs -c 255 -i 365 /dev/hdX
And it should be just that (easy? if you like Linux I guess), except e2fstools doesn't allow control over the large_files option, that I can find.
Every EXT2 filesystem I built from a e2fstools on a Fedora rescue or live CD had that LARGE_FILES option.
I could find no mkfs.ext2 or tune2fs options to make it stop.
The only way I could find to avoid the large_files bits was as ridiculous as rebuilding e2fsprogs or the entire kernel?!?
I just said no to that. I want to mess with Java, not stir around with a load of C/C++ stuff, and kernel rebuilds are fun, but not to simply remove a superblock option.
The conclusion?
Don't use a modern Linux/e2fs tools to build an EXT2 filesystem for Jnode.
--- The Way Around ---
Stepping into the Wayback machine, I pulled out a RedHat 5.2 CD set. But, that wanted to build a rescue floppy.
Sherman, that was TOO far back.
Setting the Wayback Machine forward a bit to a RedHat 6.2 CD set, booted to rescue mode from that, performed some device-foo to get the hard drive recognized as a valid device, built a single Linux 0x83 type partition on the drive, set it active, and laid down an EXT2 filesystem into it using the exact two commands I listed above. Unfortunately, RH6.2 tune2fs did not support the -l "list superblock" info to confirm that sparse_files was the only option set.
So, I set the Wayback Machine forward a bit more, booted from a Fedora Core 5 CDROM into rescue mode and enabled networking.
The FC5-supplied tune2fs showed that the filesystem options were correct, so I went ahead and ran the GRUB pieces from FC5.
I also used scp from the FC5 rescue mode to copy over the all/build/x86/32bits/bootdisk/ contents into the drive root.
Finally, I scp over some fun stuff to try out, like a simple web browser class, an e-mailer class, some desktop toys, and more to mess with if I got it working.
--- SUCCESS ---
Once I had the filesystem in place, I unmounted the Jnode disk, removed the Jnode live CD, and let it rip.
I oopsed the GRUB setup somehow, so the test boot doesn't have its menu.
I think I should have copied the menu.lst first, before doing the grub-install.
Ah well, easily fixed in the next build.
Oh wait, its FEDORA's GRUB, which wants /boot/grub/grub.conf instead of /boot/grub/menu.lst maybe that's it.
A simple "configfile /boot/grub/menu.lst" at the grub> prompt gave me the menu I wanted.
Simply wait, or press enter on Jnode (default) starts it booting.
I wait, and within a few seconds, I see:
.INFO [Ext2FileSystem]: hda0 mounting fs r/w
INFO [FileSystemMounter]: Mounted EXT2 on /devices/hda0
I am so relieved.
Once the Jshell comes up (34 seconds total boot time on that old CPU), I run gc then cd into /devices/hda0 to check it out.
Looking good... now to start messing with it!
I know its not news about earth-shattering new features or anything, but I am pretty geeked to finally get this setup and booting the way I wanted.
--- Next Steps ---
I want to build Jnode 0.2.5 using IcedTea on Fedora 8, rather than JDK7 EA B24 (which I use for work reasons).
I also want to rebuild everything from scratch and document the exact steps better, now that I know how to get this working, generally.
While I am at it, I would like to come up with a GRUB and e2fsprogs kit to build and maintain these filesystems a bit simpler than booting from stacks of various RedHat and Fedora rescue disks.
And, I would like to come up with a "System Compatibility Check" to run from the GRUB menu that lists the PCI IDs and whether or not they are supported.
--- P.S. ---
Someone, anyone, please feel free to add the Linux commands to correctly build a Jnode-friendly FAT32/VFAT/other filesystem?
- Login to post comments
mkfs.ext2 works for me, at least with a small partition (100MB)
I created a small 98 MB partition (100 MB virtual disk) and formatted it using
mkfs.ext2 /dev/sdb1 -L JNodeTests
on ubuntu server 8.10, and that works just fine. JNode can mount that (in KVM) just fine, automatically detects it, I can list dirs, touch foo, dir, del foo. peda says that means the problem does not affect me.
I have not tried bigger partitions. Either the problem was solved, Linux tools changed, or they only use the LARGE_FILE option with big disks.
mkfs.vfat -F 32
> Someone, anyone, please feel free to add the Linux commands
> to correctly build a Jnode-friendly FAT32/VFAT/other filesystem?
Just mkfs.vfat -F 32 /dev/sdb1. This works for me with JNode. The -F 32 is important: JNode does not support 16bit (FAT16) or 12bit FATs, only FAT32.
Linux (and I think DOS/Windows) create 16bit, if the partition is small enough for 16bit (e.g. 100MB). For large disks, -F 32 is chosen automatically.
Congratulations!
This is a very cool post about your JNode adventures
Could you please send us patches with the PCI Ids for the hardware that you can confirm that works with JNode but they are not included in the plugin descriptors. Then we should update the hardware compatibility list too.
But of course!
I plan to do some more hardware testing soon, when I look to upgrade this box some. Right now, I am just poking around with Jnode as the sole OS on a machine, upgrading to 3629, some other stuff.
But, yes, once I test some more hardware, I will send in some patches for the mapper IDs. I have one video card I may test today just to get a better video than this 16MB Riva going.
--
Robert "Exile In Paradise" Murphey