Issue
Hi, I was trying to make network work on qemu-system-arm uboot for tftp/dhcp booting , Could not understand QEMU 5.0.0 networking configuration needed , can you help on this.
$qemu-system-arm --version QEMU emulator version 5.0.0
Yocto BSP used: https://github.com/ahmedkassem56/meta-qemuarma9.git
$ cat /etc/qemu-ifup
#!/bin/sh
set -x
/sbin/ip a add 192.168.0.1/255.255.255.0 dev $1
/sbin/ip link set $1 up
$sudo chmod +x /etc/qemu-ifup
$ sudo qemu-system-arm -M vexpress-a9 -m 256 -kernel u-boot.elf -nographic -net tap,id=tap1,script=/etc/qemu-ifup -net nic,id=nic1
+ /sbin/ip a add 192.168.0.1/255.255.255.0 dev tap1
+ /sbin/ip link set tap1 up
U-Boot 2020.01 (Jan 06 2020 - 20:56:31 +0000)
DRAM: 256 MiB
WARNING: Caches not enabled
Flash: 128 MiB
MMC: MMC: 0
Loading Environment from EXT4... Card did not respond to voltage select!
In: serial
Out: serial
Err: serial
Net: smc911x-0
Hit any key to stop autoboot: 0
=> setenv serverip 192.168.0.1
=> setenv ipaddr 192.168.0.2
=> setenv netmask 255.255.255.0
=> setenv gatewayip 192.168.1.0
=> ping 192.168.0.1
smc911x: MAC 52:54:00:12:34:56
smc911x: detected LAN9118 controller
smc911x: phy initialized
smc911x: MAC 52:54:00:12:34:56
Using smc911x-0 device
ARP Retry count exceeded; starting again
smc911x: MAC 52:54:00:12:34:56
ping failed; host 192.168.0.1 is not alive
=>
Solution
Thankfully qemu network is working now with the below setup ..
Ref: Build a complete virtual ARM development environment based on QEMU (uboot+linux+rootfs)
~/ProjectWork/bin/$cat tuntap.sh
set -x
ETH=enp2s0 #Ethernet interface in your HOST
USR=junno #User name- whoami
if test -z $1 ; then
echo need a arg: down/up
exit
fi
if [ "up" = $1 ] ; then
brctl addbr br0
ifconfig $ETH down
brctl addif br0 $ETH
#Close Spanning Tree Protocol
brctl stp br0 off
ifconfig br0 10.8.8.1 netmask 255.255.255.0 promisc up #3
ifconfig $ETH 10.8.8.10 netmask 255.255.255.0 promisc up #2
tunctl -t tap0 -u $USR
ifconfig tap0 10.8.8.11 netmask 255.255.255.0 promisc up #4
brctl addif br0 tap0
else
ifconfig tap0 down
brctl delif br0 tap0
ifconfig $ETH down
brctl delif br0 enp2s0
ifconfig br0 down
brctl delbr br0
ifconfig $ETH 10.8.8.10 netmask 255.255.255.0 #2
fi
Add below lines $vi ~/.bashrc
alias ifup_tap='sudo ~/ProjectWork/bin/tuntap.sh up'
alias ifdown_tap='sudo ~/ProjectWork/bin/tuntap.sh down'
$ source ~/.bashrc
HOST:
cp zImage-initramfs-qemuarma9.bin /tftpboot/
cp vexpress-v2p-ca9-qemuarma9.dtb /tftpboot/
~/ProjectWork/bin$ ifdown_tap
~/ProjectWork/bin$ ifup_tap
TARGET:
~/ProjectWork/bin$ sudo qemu-system-arm -M vexpress-a9 -m 512 -nographic -net nic -net tap,ifname=tap0,script=no -kernel u-boot.elf
U-Boot 2020.01 (Jan 06 2020 - 20:56:31 +0000)
DRAM: 512 MiB
WARNING: Caches not enabled
Flash: 128 MiB
MMC: MMC: 0
Loading Environment from EXT4... Card did not respond to voltage select!
In: serial
Out: serial
Err: serial
Net: smc911x-0
Hit any key to stop autoboot: 1
=>
=>setenv serverip 10.8.8.1; setenv ipaddr 10.8.8.2; setenv netmask 255.255.255.0;
=>ping 10.8.8.1
host 10.8.8.1 is alive
//For initramfs
=>setenv bootargs "console=ttyAMA0,115200 root=/dev/ram rw"
=>tftp 0x60000000 zImage-initramfs-qemuarma9.bin
=>tftp 0x70000000 vexpress-v2p-ca9-qemuarma9.dtb
=>bootz 0x60000000 - 0x70000000
Answered By - SK17
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.