本篇不会废话,直接教如何把 Openwrt 跑在 qemu 上,教学到的内容如下
sudo apt-get update
sudo apt-get install git-core build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev subversion mercurial gcc-multilib flex git-core gettext libssl-dev unzip
https://git.openwrt.org
git clone http://git.openwrt.org/15.05/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
- 如下工作,就是为了下载此 package,如有想要下载的,可以自行开启
# cat feeds.conf.default
src-git packages https://github.com/openwrt/packages.git;for-15.05
src-git luci https://github.com/openwrt/luci.git;for-15.05
src-git routing https://github.com/openwrt-routing/packages.git;for-15.05
src-git telephony https://github.com/openwrt/telephony.git;for-15.05
src-git management https://github.com/openwrt-management/packages.git;for-15.05
#src-git targets https://github.com/openwrt/targets.git
#src-git oldpackages http://git.openwrt.org/packages.git
#src-svn xwrt http://x-wrt.googlecode.com/svn/trunk/package
#src-svn phone svn://svn.openwrt.org/openwrt/feeds/phone
#src-svn efl svn://svn.openwrt.org/openwrt/feeds/efl
#src-svn xorg svn://svn.openwrt.org/openwrt/feeds/xorg
#src-svn desktop svn://svn.openwrt.org/openwrt/feeds/desktop
#src-svn xfce svn://svn.openwrt.org/openwrt/feeds/xfce
#src-svn lxde svn://svn.openwrt.org/openwrt/feeds/lxde
#src-link custom /usr/src/openwrt/custom-feed
make menuconfig
Target System -> x86
Subtarget -> x86_64
Target Images -> 取消 GZip images
make defconfig
make prereq
# vim target/linux/x86/base-files/etc/config/network
config interface lan
option ifname eth0
option type bridge
option proto dhcp
#option proto static
#option ipaddr 192.168.1.1
#option netmask 255.255.255.0
#option ip6assign 60
make (or make V=s)
# cd bin/x86/
# ls
md5sums openwrt-x86-64-rootfs.tar.gz
openwrt-x86-64-combined-ext4.img openwrt-x86-64-vmlinuz
openwrt-x86-64-combined-squashfs.img packages
openwrt-x86-64-rootfs-ext4.img sha256sums
openwrt-x86-64-rootfs-squashfs.img
pcjustin@ubuntu:~/openwrt/bin/x86$
如果你手上没有开发板,本章教你如何跑在Qemu上,可以先玩系统。
sudo apt-get install qemu
qemu-system-x86_64 -M q35 -drive file=openwrt-x86-64-combined-ext4.img,id=d0,if=none,bus=0,unit=0 -device ide-hd,drive=d0,bus=ide.0 -redir tcp:10023::23 -redir tcp:10080::80
telnet localhost 10023
Luci 用于提供 OpenWrt 的 Web 介面
make menuconfig
LuCI -> Collections -> luci
LuCI -> Collections -> luci-ssl (https)
- 登入 Web 介面
http://localhost:10080
account: root
没有密码直接按登入(login)
Google 已被去除的项目
# git clone https://github.com/yixuaning/x-wrt.git
# cp -rf ~/x-wrt/package/webif/ ~/openwrt/package/
# make menuconfig
Administration -> webif -> 开启 webif
# make V=s
# qemu-system-x86_64 -M q35 -drive file=openwrt-x86-64-combined-ext4.img,id=d0,if=none,bus=0,unit=0 -device ide-hd,drive=d0,bus=ide.0 -redir tcp:10023::23 -redir tcp:10080::80
http://localhost:10080