PCnet / FAST III

General discussion about Visopsys.
User avatar
ronaldlees
Posts: 120
Joined: Tue May 20, 2014 5:19 pm

PCnet / FAST III

Post by ronaldlees »

Hello Andy, Visopsys devs, etc:

Recently I installed Visopsys as a VirtualBox instance. It works fine, but there is an issue with the network. Looking at the boot sequence and hardware detection entries in the kernel log, I see:

Added network adapter net0 (08:00:27:32:e5:28) link=UP
"AMD PCnet/FAST III 79C973" ethernet network adapter device detected."

When I run ifconfig, it shows:

HWaddr: 08:00:27:32:e5:28
Inet addr: 0.0.0.0 Bcast: 0.0.0.0 Mask: 0.0.0.0
Link: DOWN
txqueuelen:64 Interrupt: 10

By this point, the ifconfig GUI indicates the network is disabled. Clicking the "Enable" button in the ifconfig GUI causes the display of a message box with the message "Initializing Network" - but the system hangs for good immediately, and must be powered off in the VBox GUI.

Is the network stack complete enough at this point to do any DHCP? What is it doing when it hangs.

BTW: Love the partitioner built into the "install to disk" option. Works great.


Regards,
- Ron
User avatar
andymc
Posts: 589
Joined: Tue Nov 16, 2010 7:20 pm

Re: PCnet / FAST III

Post by andymc »

Hi Ron,

Yeah, the network implementation is just a skeleton at present - it can only do a few things, although DHCP is one of them.

Unfortunately, somewhere along the way it seems to have become broken. It does the same hanging thing in both VMware and VirtualBox. I should try to figure that out. I'm hoping to do more work on the network stack in the medium future, and get it to the point of being useful; it currently has ethernet support, IP, and UDP - but no TCP. I guess that's the hard part!
ronaldlees wrote:BTW: Love the partitioner built into the "install to disk" option. Works great.
Thanks! That's the Disk Manager, A.K.A. Partition Logic (http://partitionlogic.org.uk) :mrgreen:

Andy
User avatar
ronaldlees
Posts: 120
Joined: Tue May 20, 2014 5:19 pm

Re: PCnet / FAST III

Post by ronaldlees »

Maybe the TCP part could be ported from one of the BSDs. I suppose I could load the source and play with it. Could you give me some idea about the cross building system you're using for development ... things such as versions and whatnot - or pointers/hints to building the system? I see Visopsys is not self hosted yet.

I looked at your partition editor, It seems like a very nice tool to have, especially if you're using MS Windows. I noticed your stand alone boot-CD partition editor, which is (I'm guessing) based on Visopsys . It seems it could be pretty handy. I really don't touch Windows anymore. I only use the really arcane/unusual stuff like Haiku, Syllable, Minix3, RiscOS (open), (and now) Visopsys. I use FreeBSD when I absolutely cannot run what I want on a hobby system. And - once in a great while, I'll use Linux for crossbuilding.

Visopsys seems fairly snappy on my AMD64/FreeBSD10 version of VirtualBox. ("snappy" is a relative term when speaking of VBox, natch)

- Ron

Edit1: I see you have some version info in the BUILDING.txt file. Guess it helps to RTM :-(

Edit2: In BUILDING.txt, you indicate that you use Ubuntu to build Visopsys, so I quickly set up a hard drive instance of Debian to do the crossbuild. A plain jane Debian installation, using only "aptitude install build-essentials gettext nasm zip unzip wodim" was the only thing needed to build the system, and generate a CD iso image. That's awesome. So often, hobby OS build setups - even the well known ones - have to be tickled and teased to build. To build your's required only a couple lines at the command prompt to get the standard compiler, gettext (for msgfmt), nasm, zip, and wodim. Beautiful!
Last edited by ronaldlees on Sat Nov 29, 2014 2:54 pm, edited 2 times in total.
User avatar
ronaldlees
Posts: 120
Joined: Tue May 20, 2014 5:19 pm

Re: PCnet / FAST III

Post by ronaldlees »

I'm not really a kernel dev - I've always coded userland progs. But - in spite of my shortcomings there, I decided to be the dangerous guy and put some code into kernelNetwork.c to poke debug-print info into the kernel log, especially in the area of networkInitialization. I built the ISO by using the image-cd.sh script, and installed that ISO on a VBox vdi "drive". The installer didn't seem to create a simple MBR, and the resulting installation wouldn't boot. Then I noticed that the generated ISO image is 6Mbytes, while the downloaded official ISO is 20Mbytes.

I knew the official ISO image allows for a "simple MBR" to be copied to the destination drive, so I used the official ISO, made the simple MBR, and Visopsys started up fine. Then I took the generated ISO (with the debug statements), mounted it, and simply copied the newly compiled kernel and libs over to the vdi. Visopsys rebooted fine with the new kernel. Then I looked for the new debug info. Note: I suppose I could have manually copied the MBR (or am I missing something in the generated ISO installer? The generated ISO installer started in graphics mode, while the official ISO installer started up in text mode.)
Last edited by ronaldlees on Sat Nov 29, 2014 2:48 pm, edited 3 times in total.
User avatar
ronaldlees
Posts: 120
Joined: Tue May 20, 2014 5:19 pm

Re: PCnet / FAST III

Post by ronaldlees »

So as not to give newcomers the wrong impression, let me add that Visopsys runs pretty well, IMO. The networking is pretty skeletel, as Andy points out. But, in a few days time, I've exercised the OS a fair amount, and other than the times when I tried to initiate networking, it's never required a reboot. I can see Visopsys as a nifty little way to access the web, maybe starting with a text mode browser. It'd be stable enough for me, and I like that it's about half the size of Syllable, which is itself half the size of Haiku (codebase wise). It runs more quickly in VBox than Haiku. (Admittedly that's gut-feeling, and not scientific measurement :-) )

Anyway...

The result of my dangerous little test was a mixed bag. Sometimes the system hung when the NetworkInitialization function was executed, and then it never got as far as the DHCP request. After a few tries, Visopsys didn't hang at NetworkInitialization, but instead it managed to get at least some info from the DHCP server, display it, and post an "Enabled" message in the dialog. Unfortunately, after about five seconds it hung again. So - I've gotten my feet wet a little. Andy: I suppose you use Qemu/Gdb to be serious about this? What's your setup?
User avatar
andymc
Posts: 589
Joined: Tue Nov 16, 2010 7:20 pm

Re: PCnet / FAST III

Post by andymc »

ronaldlees wrote:In BUILDING.txt, you indicate that you use Ubuntu to build Visopsys, so I quickly set up a hard drive instance of Debian to do the crossbuild. A plain jane Debian installation, using only "aptitude install build-essentials gettext nasm zip unzip wodim" was the only thing needed to build the system, and generate a CD iso image. That's awesome. So often, hobby OS build setups - even the well known ones - have to be tickled and teased to build. To build your's required only a couple lines at the command prompt to get the standard compiler, gettext (for msgfmt), nasm, zip, and wodim. Beautiful!
Great, I'm glad it was smooth for you 8-) I haven't put much effort into configuring a native compiler, as this works pretty well for now, and there are lots of great developer tools available for Linux. Right now it's easiest to install to a USB stick or ISO, and run in a VM or boot another system (various laptops, usually) with a stick. I primarily use VMware and a small, dedicated partition on my physical hard disk. I install to the partition, launch the VM, and choose Visopsys from GRUB. This means I can also reboot my dev workstation, select it in GRUB, and test on my real workstation hardware. I also use VirtualBox a bit, with an ISO image. I'm currently using that to try and debug APIC issues.
User avatar
andymc
Posts: 589
Joined: Tue Nov 16, 2010 7:20 pm

Re: PCnet / FAST III

Post by andymc »

ronaldlees wrote:I'm not really a kernel dev - I've always coded userland progs. But - in spite of my shortcomings there, I decided to be the dangerous guy and put some code into kernelNetwork.c to poke debug-print info into the kernel log, especially in the area of networkInitialization. I built the ISO by using the image-cd.sh script, and installed that ISO on a VBox vdi "drive". The installer didn't seem to create a simple MBR, and the resulting installation wouldn't boot. Then I noticed that the generated ISO image is 6Mbytes, while the downloaded official ISO is 20Mbytes.

I knew the official ISO image allows for a "simple MBR" to be copied to the destination drive, so I used the official ISO, made the simple MBR, and Visopsys started up fine. Then I took the generated ISO (with the debug statements), mounted it, and simply copied the newly compiled kernel and libs over to the vdi. Visopsys rebooted fine with the new kernel. Then I looked for the new debug info. Note: I suppose I could have manually copied the MBR (or am I missing something in the generated ISO installer? The generated ISO installer started in graphics mode, while the official ISO installer started up in text mode.)
The installer doesn't mess with your MBR typically. If someone installs a dual-boot on a real machine with, for example, GRUB, we don't want to muck up their boot configuration. It's necessary to launch the partitioning program if you want to do that (write a simple MBR, or create the boot menu). I suppose a bit more run-time guidance would be helpful in that respect, especially when people are installing in VMs with empty virtual disks, as you did. The installer should probably offer to do that, I guess.
User avatar
ronaldlees
Posts: 120
Joined: Tue May 20, 2014 5:19 pm

Re: PCnet / FAST III

Post by ronaldlees »

On my linux setup, from the root dir of the source tree I can use QEMU with:

Code: Select all

qemu-system-i386 -hda ./linuxdisk.img -kernel  ./arch/i386/boot/bzImage
                            -append "root=/dev/sda1 console=ttyS0" -s -serial stdio
Then, in another terminal I can run

Code: Select all

  gdb ./vmlinux
        (loading debug symbols)

  (gdb) target remote localhost:1234
And from that point I can single step through the C source of the running linux kernel. This setup takes advantage of the fact that the bootloader built into QEMU can directly load the linux kernel. Using the -k option in this way is really handy, because I can point to a new kernel to test, with no hassles whatsoever. (As opposed to building a complete bootable disk image, and mounting it to change the kernel).

How does the Visopsys kernel play into this picture? The bootloader is completely different than the one in QEMU, so how would I go about getting a setup similar to what I can use with Linux?
User avatar
ronaldlees
Posts: 120
Joined: Tue May 20, 2014 5:19 pm

Re: PCnet / FAST III

Post by ronaldlees »

I found a compact listing of the QEMU built-in bootloader here:

http://facetlife.blogspot.com/2010/12/ ... oader.html

So, it should be possible to mix and match, or even to change the bootloader? Being an appside guy, I don't really feel at home until I can single step live.


Edit: Oops - that seems to be the arm version. Anyway - the same but different :-(
User avatar
andymc
Posts: 589
Joined: Tue Nov 16, 2010 7:20 pm

Re: PCnet / FAST III

Post by andymc »

That would be cool, if you could figure out how to single-step Visopsys from a VM :ugeek:

Visopsys chain-loads, exactly the same as Windows (but unlike Linux). You just load the first sector of the Visopsys partition into the memory location 0x00007c00 and jump to it. More or less.

Unlike the boot sector 0, the OS loader (/vloader) does do some fairly Visopsys-specific stuff: gathering info from the real-mode BIOS, setting the video mode, setting up basic memory paging, switching to protected mode, passing arguments to the kernel, etc. Not so easy to swap that out :lol:
Post Reply