ReturnInfinity/BareMetal-OS

How to build ethtoolc

Closed this issue · 11 comments

I would like to build ethtoolc.c and some of the other apps but they won't build from app.sh or the makefile in Examples or even using the instructions in the top of the source file. I just need some pointers/general direction on where to start. I naively tried the following based on the comments in the source file:

gcc -c -m64 -nostdlib -nostartfiles -nodefaultlibs -o ethtoolc.o ethtoolc.c -I ../../output/include -I ../
gcc -c -m64 -nostdlib -nostartfiles -nodefaultlibs -o libBareMetal.o libBareMetal.c
ld -T example.ld -o ethtoolc.app ethtoolc.o libBareMetal.o  -L ../../output/lib -L ../../output/x86_64-pc-baremetal/lib/ -lc -lbmfs -L ../Alloy/lib -lalloy

but where do I get definitions for b_output, et. al.?

ethtoolc.o: In function `main':
ethtoolc.c:(.text+0x17): undefined reference to `b_output'
ethtoolc.c:(.text+0x17): relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `b_output'
ethtoolc.c:(.text+0x2b): undefined reference to `b_system_config'
ethtoolc.c:(.text+0x2b): relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `b_system_config'
ethtoolc.o: In function `ethtool_send':
ethtoolc.c:(.text+0xc7): undefined reference to `b_ethernet_tx'
ethtoolc.c:(.text+0xc7): relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `b_ethernet_tx'
ethtoolc.o: In function `ethtool_receive':
ethtoolc.c:(.text+0x101): undefined reference to `b_ethernet_rx'
ethtoolc.c:(.text+0x101): relocation truncated to fit: R_X86_64_PLT32 against undefined symbol `b_ethernet_rx

FYI the goal here is to write a tcp server so if this is the wrong way to go about it let me know... thanks!

All of the old apps need to be revisited as a few things have changed around in the kernel. As for a TCP server running on BareMetal I have this working via https://github.com/IanSeyler/minIP

I built minIP, (default standalone) installed and ran but it just hangs without any output. The other apps on the image such as hello.c and sysinfo work.
In general to convert the old apps, what is the procedure?
Does it make sense to try to port a stack such as FreeRTOS TCP stack?

Thanks for that info. I have some serious cleanup to do as the kernel API changed around a bit. I will try to take a look at this over the weekend.

It might be worth the try to port something. The concern is what the stack depends on. An older version of lwIP (https://github.com/ReturnInfinity/BareMetal-lwIP) was ported successfully in the past.

Yeah - minIP is using an older kernel API so I have some changes to make.

@IanSeyler I think I'll be able to fix this later today

@tay10r Don't worry about it for the moment. I'm in the middle of cleaning up some stuff over on GitLab. Once that is done I will make the GitHub repos for the kernel and Pure64 read-only.

minIP on GitLab uses the newer kernel API.

Oh okay gotcha

A bunch of the repos here on GitHub are now archived(read only). As I verify the old test apps still work (or fix them) they will be added to GitLab.

@afrantisak I have a working version of ethtoolc.c (now called ethtest.c) here:
https://gitlab.com/ianseyler/BareMetal-test/blob/master/ethtest.c

minIP works as well.