qemuベリーパイ接続ネットワーク

7427 ワード

デッドサイクル起動の修正
コマンドを入力:
nano/etc/ld.so.preload
1行しかないファイルが開きます
/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
行の先頭に#記号を付けます(現在は英国式キーボードです).
#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
死のサイクルが始まったら
使用
qemu-system-arm -kernel kernel-qemu -cpuarm1176 -m 256 -M versatilepb -append “root=/dev/sda2 panic=1 init=/bin/sh rw” -hda 2013-07-26-wheezy-raspbian.img

panic=1 init=/bin/sh rwを追加
かくさんようりょう
qemu-img resize 2012-12-16-wheezy-raspbian.img +2G
rasp-config
選択expand_rootfs
誤報を出す
there was an error running do_expand_rootfs
ベリーパイに入る必要があります
vi/etc/udev/rules.d/90-qemu.rules
ファイルを作成します.
入力内容:
view plaincopy to clipboardprint?
   
KERNEL=="sda", SYMLINK+=”mmcblk0”  
KERNEL=="sda?", SYMLINK+=”mmcblk0p%n”,  
     
  http://hi.baidu.com/shenaodong/item/bd82e0c931041a7fcfd4f835
 cp /usr/bin/raspi-config ~
sed -i ‘s/mmcblk0p2/sda2/’ ~/raspi-config
sed -i ‘s/mmcblk0/sda/’ ~/raspi-config
sudo ~/raspi-config
  http://www.shumeipai.net/thread-13642-1-1.html

apt-get  

http://www.linuxidc.com/Linux/2013-10/91012.htm

vi /etc/apt/sources.list

プロファイルの変更pi@aborn ~ $ vi/etc/apt/sources.list
deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb http://mirrors.neusoft.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb-src http://mirrors.neusoft.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb http://mirrors.ustc.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi
deb-src http://mirrors.ustc.edu.cn/raspbian/raspbian/ wheezy main contrib non-free rpi

ダウンロード
2012-12-16-wheezy-raspbian.img
kernel-qemu
2012-12-16-wheezy-raspbian.imgに必要なカーネルは3.2.27+
cd/lib/modules && ls
表示
kernel-qemuが提供するカーネルは3.10である.26+
uname -r
表示
完全に一致していないので、iptablesは使いにくいです.
新聞
root@raspberrypi:~# iptables -L
libkmod: ERROR ../libkmod/libkmod.c:554 kmod_search_moddep: could not open moddep file ‘/lib/modules/3.10.26+/modules.dep.bin’
iptables v1.4.14: can’t initialize iptables table `filter’: Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

ブリッジネットワークの使用には影響しません
ブリッジ接続qemuのベリーパイを使用してネットワークに接続
構成スクリプトは/root/xupなど、どこかに配置されます.
view plaincopy to clipboardprint?
   
[root@localhost qemu]# cat /root/xup   
#!/bin/sh  
/sbin/ifconfig $1 0.0.0.0 promisc up  
/usr/sbin/brctl addif br0 $1  
sleep 2  
      
  http://ju.outofmemory.cn/entry/45837

view plaincopy to clipboardprint?
   
modprobe tun  
lsmod|grep tun  
ifdown eth0  
ifconfig  eth0 0.0.0.0 promisc up  
brctl addbr br0  
brctl addif br0 eth0  
brctl stp br0 off  
ifconfig br0 192.168.1.55 netmask 255.255.255.0 broadcast 192.158.1.255  
route add default gw 192.168.1.1  
ifup eth0  
  qemu

view plaincopy to clipboardprint?
   
[root@localhost qemu]# cat run.sh   
#!/bin/sh  
#qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -append "root=/dev/sda2" -hda 2012-12-16-wheezy-raspbian.img -vnc 192.168.1.111:1 -net nic -net user &  
  
#qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -append "root=/dev/sda2" -hda 2012-12-16-wheezy-raspbian.img -vnc 192.168.1.111:1 -net nic,vlan=0  &  
  
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -append "root=/dev/sda2" -hda 2012-12-16-wheezy-raspbian.img -vnc 192.168.1.111:1 -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=/root/xup  &  
    
  
[root@localhost qemu]# ifconfig  
br0       Link encap:Ethernet  HWaddr 00:0C:29:D5:D3:28    
          inet addr:192.168.1.55  Bcast:192.158.1.255  Mask:255.255.255.0  
          inet6 addr: fe80::20c:29ff:fed5:d328/64 Scope:Link  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1  
          RX packets:22612 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:30629 errors:0 dropped:0 overruns:0 carrier:0  
          collisions:0 txqueuelen:0   
          RX bytes:4281564 (4.0 MiB)  TX bytes:8026132 (7.6 MiB)  
  
eth0      Link encap:Ethernet  HWaddr 00:0C:29:D5:D3:28    
          inet addr:192.168.1.111  Bcast:192.168.1.255  Mask:255.255.255.0  
          inet6 addr: fe80::20c:29ff:fed5:d328/64 Scope:Link  
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1  
          RX packets:56725 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:33717 errors:0 dropped:0 overruns:0 carrier:0  
          collisions:0 txqueuelen:1000   
          RX bytes:36072369 (34.4 MiB)  TX bytes:8180253 (7.8 MiB)  
  
lo        Link encap:Local Loopback    
          inet addr:127.0.0.1  Mask:255.0.0.0  
          inet6 addr: ::1/128 Scope:Host  
          UP LOOPBACK RUNNING  MTU:16436  Metric:1  
          RX packets:162 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:162 errors:0 dropped:0 overruns:0 carrier:0  
          collisions:0 txqueuelen:0   
          RX bytes:14560 (14.2 KiB)  TX bytes:14560 (14.2 KiB)  
  
tap0      Link encap:Ethernet  HWaddr B6:94:52:0E:11:1F    
          inet6 addr: fe80::b494:52ff:fe0e:111f/64 Scope:Link  
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1  
          RX packets:320 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:527 errors:0 dropped:0 overruns:0 carrier:0  
          collisions:0 txqueuelen:500   
          RX bytes:40975 (40.0 KiB)  TX bytes:49074 (47.9 KiB)  
  
[root@localhost qemu]#   

ベリーパイネットワーク

root@raspberrypi:~# ifconfig  
eth0      Link encap:Ethernet  HWaddr 52:54:00:12:34:56    
          inet addr:192.168.1.114  Bcast:192.168.1.255  Mask:255.255.255.0  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1  
          RX packets:490 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:298 errors:0 dropped:0 overruns:0 carrier:0  
          collisions:0 txqueuelen:1000   
          RX bytes:46824 (45.7 KiB)  TX bytes:37286 (36.4 KiB)  
          Interrupt:57 Base address:0x8000 DMA chan:ff   
  
lo        Link encap:Local Loopback    
          inet addr:127.0.0.1  Mask:255.0.0.0  
          UP LOOPBACK RUNNING  MTU:65536  Metric:1  
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0  
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0  
          collisions:0 txqueuelen:0   
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)  
  
root@raspberrypi:~#    

その他の設定リファレンス
http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/