TCP/IP stack

81 views
Skip to first unread message

Sergei Lodyagin

unread,
Sep 10, 2021, 8:11:49 AM9/10/21
to BareMetal OS
Hey, it's been quite a while since I've been here. 
Just to remind people, I developed some part of a standard C++ library for BareMetal OS - https://github.com/lodyagin/bare_cxx.
Now I have some inspiration to develop TCP/IP stack. It is because I am working with TCP/IP professionally now (in a company which makes devices for network analysis), have regular conversation with some good experts in the field and want to implement some ideas which I have by myself. So this stack will not be like any existing stack but will collect some experience I'd like to put in a code for usage by other people. Like writing a book, you know. It will be extensible, designed  to allow experiments and developing other network applications on top of it.
As a target I've selected BareMetal OS, just because I really like this system and also I have my C++ library which I probably can use for the task.
If somebody wants to join me in these efforts, you are welcome.
My question is: which hardware (network card/chips/family) do you think is better to use for the first implementation? I have some special good-quality devices in mind, but for the first version I would prefer to use something most of people has access to. So if somebody is interested in trying of my TCP/IP stack please suggest the network adapter type which you would prefer to use with BareMetal OS.

I understand that the group had no much activity last few years, but the code is still alive so I definitely can use it for my goal.
The stack will be portable to other OSes as well, but what is special about BareMetal is a ultimate freedom on the stage of the implementation, so this version could be used as a reference to porting to any other architectures (like Smart NICs etc) without any need to port OS itself.

Sergei

Fred Eckert

unread,
Sep 15, 2021, 1:42:49 PM9/15/21
to BareMetal OS
Hello, I have been watching this OS for a long time from a distance.  Do you know if UEFI support was ever added?

I have just recently started to explore UEFI. I was thinking that maybe it is possible to use the UEFI provided UNDI device driver (universal network driver interface), for a TCP/IP stack. This would be pretty cool if it was possible and provided good performance.

I have been working with the WinSystems EBC-C413. It uses the InsydeH2O UEFI firmware. I have a confirmation from Insyde that they use a  binary from Intel to provide a UNDI driver for the Intel I210 GBE. But, I have not yet tested to see if it is actually working.

I may try again to see if I can get BMOS to run on real hardware. I see that some people have gotten it to work.

FredE

Sergei Lodyagin

unread,
Sep 16, 2021, 3:01:08 PM9/16/21
to BareMetal OS
Hello Fred.

I can say 2 things:
1. I can run BareMetal on real hardware, yes, but it requires some modification to the current source repository available at ReturnInfinity Github. Probably the easiest thing for me to do is to put the corrected sources somewhere on my Github. I mean "corrected" in a sense of just workability.
2. I personally have no interest to implement UEFI. I have the interest to make some experimental code base for supporting a new generation of hardware like Smart NICs, Smart SSD, Neutral network accelerators, etc by some consistent and testable programming approach. So, I'd like to focus only on some limited piece of code, in this case, the NIC part. It will allow to use of the computer as, let say, a network monitoring or traffic generator tool, not touching other parts of the computer system. I feel that the current approach (like with Linux) when you use separate software on the NIC board (firmware layer), separate pieces/drivers in the operating system, and the user space program will not work well for modern architectures where you really should be able to choose whether to put your software in NIC board processor or in the main CPU processor and should be able to balance between them. 

So, I don't want to extend the BareOS kernel (apart from possible fixes) but just to make some useful library and on this step, it would be a library for exploring TCP/IP networking.

As for network adapters, for a free software project, I have a strong opinion to support only those having documentation. 

But we need some mechanism to enumerate devices on the PCI bus first to make all necessary memory mappings before implementing bare packet operations on the network adapter. So I would start with writing BareMetalOS utility for access computer IO ports. Let's explore how to play with bare IO ports in a safe way. Most OSes (all?) hide them from a user.
The next step could be implementing some simple (not TCP/IP based) "bare" file transfer protocol between a network card (the same model) installed in BareMetalOS computer and Linux computer. Probably combined with a terminal to extend the ability of BareMetalOS computer with missing external services from a Linux box.

So, this is my plan.

Sergei
среда, 15 сентября 2021 г. в 19:42:49 UTC+2, frede...@hotmail.com:

Frederick Eckert

unread,
Sep 19, 2021, 8:25:13 AM9/19/21
to bareme...@googlegroups.com

Hello Sergei,

 

I like your plan. I would like to join you in this undertaking.

 

I personally would like to obtain the following out of the effort:

 

  1. Understand if BareMetal is a suitable replacement for DOS for embedded realtime control.
  2. Learn how PCI differs from ISA
  3. Analysis of the stability and speed of BareMetal ISA and PCI I/O
  4. A working TCP/IP stack

 

If you post your working version of BareMetal on your GitHub, I will download a copy and see if I can get it working on my old Intel N450 dev board. If it works great. If not, I will purchase any platform you recommend.

 

Because I am a PCI beginner, I may not be able to make any major contributions initially but, I can test your code and assist as possible. I have access to a PCIe data acquisition board with full documentation. I would like to use your BareMetal I/O utility to explore this board. I would use the board’s DAC with bare I/O read / writes to generate a sinewave. By watching this waveform on an oscilloscope I can see how stable the platform is.

 

Fred

 

Sent from Mail for Windows

--
You received this message because you are subscribed to the Google Groups "BareMetal OS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to baremetal-os...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/baremetal-os/30066fbf-300b-4664-8d87-6a493758089bn%40googlegroups.com.

 

Sergei Lodyagin

unread,
Sep 29, 2021, 2:09:58 PM9/29/21
to BareMetal OS
Hello.

So I continue the development of my C++ library and TCP/IP in my local fork on https://github.com/lodyagin/BareMetal-OS.git
You can clone it, run ./setup.sh and use the generated bin/bmfs.image to write directly on a dedicated (for BareMetal OS) HDD:
cp bin/bmfs.image /dev/sdX  (X is a, b, c - be careful not to overwrite another drive). Pay attention to copy the image on the whole drive, not
to a partition (the names of partitions are like /dev/sda1, /dev/sda2, etc. You need /dev/sda in this case).

I used Linux live cd USB stick on the target computer to get bmfs.image by sftp and then to cp it directly on HD.
The OS is workable but I made some modifications to official branches, actually returning the state back to 2017 when I worked with the OS.

Sergei

воскресенье, 19 сентября 2021 г. в 14:25:13 UTC+2, frede...@hotmail.com:

Fred Eckert

unread,
Sep 30, 2021, 10:23:39 PM9/30/21
to BareMetal OS
Hi

I was able to clone the repo and boot it on my single core Atom N450 board (Intel® Embedded Development
Board 1 - N450). I had some trouble at first with a hang here:

[cpu: 2 x 1589 MHz]  [mem: 1012 MiB]  [hdd:

To get past this issue, I changed the IDE controller from: [Enhanced Mode] SATA Mode [AHCI Mode] to [Compatible Mode] IDE Mode [SATA Only]

Now I see the following boot message:

[cpu: 2 x 1589 MHz]  [mem: 1012 MiB] [hdd: N/A] [net: N/A]
BareMetal is ready
>

I tested all the internal commands, all worked properly except the reboot command which locked up the system.

I was happy to see it start up but, when I tried to load a few programs such as hello.app and sysinfo.app. They appeared to write into the bmos.image but, they did not appear when I issued the dir command. 

This is what I see when I type dir:
> dir
Disk Size: 0 MiB
Name                                | Size (Byte)                 | Reserved (MiB)
===================================================
>

Perhaps my platform is not compatible with the OS. Do you recommend I purchase a "supported" platform or should I try to debug the hang? I will need a new platform anyways to use multicore. So I am ready to get something if necessary.

Best regards,
FredE

Sergei Lodyagin

unread,
Oct 1, 2021, 3:53:50 AM10/1/21
to BareMetal OS
Hello Frederick.

пятница, 1 октября 2021 г. в 04:23:39 UTC+2, frede...@hotmail.com:
Hi

I was able to clone the repo and boot it on my single core Atom N450 board (Intel® Embedded Development
Board 1 - N450). I had some trouble at first with a hang here:

[cpu: 2 x 1589 MHz]  [mem: 1012 MiB]  [hdd:

To get past this issue, I changed the IDE controller from: [Enhanced Mode] SATA Mode [AHCI Mode] to [Compatible Mode] IDE Mode [SATA Only]


That's strange. It works in AHCI mode on my DELL laptop. I will check what could be wrong, I did some tricks with AHCI in my branch.
 
Now I see the following boot message:

[cpu: 2 x 1589 MHz]  [mem: 1012 MiB] [hdd: N/A] [net: N/A]
BareMetal is ready
>

I tested all the internal commands, all worked properly except the reboot command which locked up the system.

I was happy to see it start up but, when I tried to load a few programs such as hello.app and sysinfo.app. They appeared to write into the bmos.image but, they did not appear when I issued the dir command. 

This is what I see when I type dir:
> dir
Disk Size: 0 MiB
Name                                | Size (Byte)                 | Reserved (MiB)
===================================================
>

Perhaps my platform is not compatible with the OS. Do you recommend I purchase a "supported" platform or should I try to debug the hang? I will need a new platform anyways to use multicore. So I am ready to get something if necessary.


I think there is nothing wrong with your platform. I have to test it by myself. It is not the official branch, so I will figure out what could be wrong with my version.


Meantime I am finishing the "iodump" utility which shows data from all IO ports. It is the first step on my PCI road.

Sergei

Fred Eckert

unread,
Oct 4, 2021, 1:33:07 PM10/4/21
to BareMetal OS
Hi Sergei,

It is great to see your updates going into bare_cxx. Looking forward to being able to run the iodump utility on my hardware!

I tried to run your repo on 3 different machines and none of them worked. My little Intel N-450 comes the closest to working, making it past Pure64 and into the BareMetal OS. All the other PCs hang while still in Pure64. I also tried the newest official  ReturnInfinity/BareMetal  repo and it just hangs instantly on my N-450.

I did a diff on your repo and the BareMetal-Legacy repo and found them to be equal. You mentioned that you did some work on AHCI to get it working on your machine. Did you need to add this work into lodyagin/BareMetal-OS-legacy?

I will continue to see if I can get something working on my Intel N-450.

Fred

Sergei Lodyagin

unread,
Oct 4, 2021, 3:01:29 PM10/4/21
to BareMetal OS
Frederick,

If you use my BareMetal-OS-legacy repo make sure you use the "stable" branch. I put my corrections in this branch only, so master is the same (to keep tracking of changes easy with the official repo). When you build the system make sure all repos are switched to "stable". But my setup.sh script should do it automatically, just check it, like this:

cd src/BareMetal-OS  # or any other name
git branch  # should be "stable"

Also, as I said before, make sure you BIOS is configured to use AHCI mode for HDD.

понедельник, 4 октября 2021 г. в 19:33:07 UTC+2, frede...@hotmail.com:

Fred Eckert

unread,
Oct 4, 2021, 10:23:20 PM10/4/21
to BareMetal OS
Ok. My Bad. I was comparing the wrong branch. I built the master branch with the (c) 2016 AHCI driver. On my dev PC, it hangs in the same place as the stable branch (c) 2013 AHCI driver. I looked at the BMOS Official (c) 2020 AHCI driver and it has changed quite a bit and likely won't just drop into the legacy code.

I will continue to see what I can do on my side to get this figured out and working. Let me know if you find anything on your side.

Fred

Reply all
Reply to author
Forward
0 new messages