RetroBSD

2.11BSD operating system for microcontrollers
It is currently Wed Jun 19, 2019 12:58 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Sun Feb 07, 2016 6:08 am 
Contributor
User avatar

Joined: Sun Oct 20, 2013 3:15 am
Posts: 322
Easy steps to get networking on your LiteBSD QEMU image without needing to setup a tap interface:
1. Install Serge's modified qemu following the wiki directions (https://github.com/sergev/qemu)
2. Use the MEBII kernel (bonus: no bios needed)
3. Create this as run-litebsd.sh
Code:
#!/bin/sh
/usr/local/qemu-mips/bin/qemu-system-mipsel -machine pic32mz-meb2 \
    -nographic -monitor none -serial stdio \
    -kernel vmunix.hex -sd sdcard.img

4. Start LiteBSD (./run-litebsd.sh)
5a. Login as root
5b. Edit /etc/netstart -- change 20.2.2.1 to 10.0.2.15
5c. Create a file named /etc/resolv.conf and put a single line in it:
Code:
nameserver 8.8.4.4

5d. Run 'sh /etc/netstart'
5e. Execute the following command:
Code:
# route add -net 0 10.0.2.2


Congrats! That's it. You will have to re-run step 5e every time you restart your LiteBSD machine. Also, the ping(8) utility won't work this way. But ftp and http will. I recommend trying to install a package as a test, something like:
Code:
# pkg add cgo-0.4.1


HTH

_________________
@__briancallahan on Twitter


Top
 Profile  
 
PostPosted: Sun Feb 07, 2016 8:40 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Brian,

Very Nice.

How about a piece about how I got LiteBSD itself on the web. I am thinking about this on a chip level. Hook this chip to these pins with this circuit rather than buy this module. Eventually one of us will make a PCB :).

I think Serge may have ethernet running on his Microchip board? So this may be one known to work path?

I have the ChipKIT WiFire board, so perhaps an ethernet chip would need to be attached to it and drivers activated/installed? Or enough of a WiFi driver done to do the same thing.

Also, I think it would be most useful to be able to download as a single download all the currently working 'packages' in whatever format that go along with the current kernel so they can be accessed locally and the whole load easily upgraded from time to time.

Amazing to watch your progress :). News every day :) :).

Lots of fun :).

Wiz


Top
 Profile  
 
PostPosted: Mon Feb 08, 2016 3:23 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Hi Wiz,
I have ethernet running on Microchip MEB-II board since 15-Feb-2015, almost a year ago. Did you see the Networking page on LiteBSD wiki site?

Hi Brian,
I've added /etc/resolv.conf file and modified the default netstart script, so now the network is started right away under QEMU. The ethernet driver is still not quite stable. When I try to transfer a relatively big file, the FTP session suspends with some driver messages like:
Code:
en0: receive error: irq 82
en0: receive error: irq a
en_recv: no SOP flag (2000100)
en_recv: no SOP flag (2000000)
en_recv: no SOP flag (2000000)
en_recv: no SOP flag (2000000)
en_recv: unexpected EOWN flag (desc 7e78 = 41ea0080)
en0: receive error: irq 2

Looks like the driver does not properly handle the receive buffer overflow. I need to fix this somehow.


Top
 Profile  
 
PostPosted: Mon Feb 08, 2016 4:51 am 
Contributor
User avatar

Joined: Sun Oct 20, 2013 3:15 am
Posts: 322
Hey Serge --

How big is big? This might explain some http/links+ problems I've been having.

_________________
@__briancallahan on Twitter


Top
 Profile  
 
PostPosted: Mon Feb 08, 2016 5:35 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
In case of FTP transfer, typically about 110-130 kbytes goes fine, then it hangs up.

Ping of the QEMU host works as expected:
Code:
# ping 10.0.2.2     
PING 10.0.2.2 (10.0.2.2): 56 data bytes
64 bytes from 10.0.2.2: icmp_seq=0 ttl=255 time=0.268 ms
64 bytes from 10.0.2.2: icmp_seq=1 ttl=255 time=0.186 ms
64 bytes from 10.0.2.2: icmp_seq=2 ttl=255 time=0.177 ms
^C
--- 10.0.2.2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.177/0.21/0.268 ms

But when I try to ping some remote server, the data come damaged:
Code:
# ping litebsd.org.
PING litebsd.org (166.84.7.114): 56 data bytes
64 bytes from 166.84.7.114: icmp_seq=0 ttl=255 time=-1.57771e+12 ms
wrong data byte #8 should be 0x8 but was 0xa
        31 1 c2 b4 a6 54 7 72 a 0 1 6f 0 0 ad 1b 29 0 0 0 43 22 b8 56 43 68 0 0 8 9 a b
        c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b
64 bytes from 166.84.7.114: icmp_seq=0 ttl=255 time=1.83901e+11 ms (DUP!)
wrong data byte #8 should be 0x8 but was 0xa
        31 1 c2 4b a6 54 7 72 a 0 1 6f 0 0 23 29 29 0 1 0 44 22 b8 56 cb 5a 0 0 8 9 a b
        c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b
64 bytes from 166.84.7.114: icmp_seq=0 ttl=255 time=1.82813e+12 ms (DUP!)
wrong data byte #8 should be 0x8 but was 0xa
        31 1 c1 e9 a6 54 7 72 a 0 1 6f 0 0 6d 32 29 0 2 0 45 22 b8 56 7f 51 0 0 8 9 a b
        c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b
^C
--- litebsd.org ping statistics ---
3 packets transmitted, 1 packets received, +2 duplicates, 66% packet loss
round-trip min/avg/max = -1.57771e+12/2.14748e+06/1.82813e+12 ms

I guess it's something related to the changed mode of QEMU network interface. It was -net tap, now it is -net user.


Top
 Profile  
 
PostPosted: Mon Feb 08, 2016 5:56 am 
Contributor
User avatar

Joined: Sun Oct 20, 2013 3:15 am
Posts: 322
That's interesting.
For me (on Linux), ping does not work except for 10.0.2.2.
QEMU does not guarantee that ping will work with user mode networking, so I never thought anything of it.

When I try to ping (for example), litebsd.org, ping will resolve the IP address but will have 100% packet loss.

_________________
@__briancallahan on Twitter


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission