This page is not fully translated, yet. Please help completing the translation.
(remove this paragraph once the translation is finished)
本指南的目标是指导你通过简单的几个步骤，编译出自己的，可以用于烧写的固件. 适用于windows用户和Debian/Ubuntu用户. 需要使用一个64位版本的windows，以及至少8GB的剩余磁盘空间. 在Mac上也类似 (可以使用Virtualbox), 但是我没有，所以没测试过.
自己编译固件的好处是减少空间占用，路由器的flash通常小于16MB. 再有，就是有一些选项只能在编译时改变，比如BusyBox中包含的一些feature. 再比如SquashFS的block size，block size较大时，压缩效果更好，但是加载文件的时间会变长.
如果你已经有了Debian/Ubuntu server，可以跳至下一步part 2.
除了在windows上安装虚拟机外，windows 10 用户可以在Microsoft Store安装Ubuntu并跳至第二步. 安装后，运行以下命令:
sudo apt-get update sudo apt-get upgrade
The interface for changing the keyboard is a bit weird, but you can find the correct place like this:
From now on, whenever you should be in the terminal to type a command the syntax will look like this:
meaning you should type ls -l and press enter (try it). Follow up questions with obvious answers like typing the passsword (osboxes.org) og confirming with y will not be included specifically in this guide. Cut and paste will unfortunately not work at this moment.
su - nano /etc/apt/sources.list
You are now editing the list of servers to get updates from.
deb http://deb.debian.org/debian/ stretch main contrib deb-src http://deb.debian.org/debian/ stretch main contrib
apt update apt dist-upgrade reboot
Log in and open the terminal again when it has rebooted.
su - apt install linux-headers-amd64 make sudo
Click Devices (top line), select the last option (Install Guest Additions). The automatic install does not seem to work, so it doesn't matter if you select cancel or run.
sh /media/cdrom/VBoxLinuxAdditions.run poweroff
After this you will need to start the server again. Now you can change to a higher resolution so you get a larger window if you like:
And lastly (hopefully you can cut and paste now). Note that cut and paste only works for text without any kind of formatting. You may need to copy the text to notepad and then copy it from there to clean it up.
su - adduser osboxes sudo echo ' osboxes ALL=(ALL) ALL' >> /etc/sudoers exit
Your virtual Debian server should now be set up correctly for following the rest of the guide. Congratulations. As a bonus, you now have a fully functional Linux computer that you can use for anything, and with the added safety of running it as a virtual machine. If you let the resolution match your monitor and select View/Full-screen mode there is almost no difference from a standalone Linux computer.
参考 Quick Image Building Guide , “cd openwrt”然后运行以下命令以获得最新稳定版本:
git tag git branch
能看到tag名，发布版本和开发分支的列表. Check out你想要的那个：
git checkout <tag or branch name>
Then continue following the Quick Image Building Guide
You select a package using space one or more times. When you select something, always make sure it has a * and not an M in the selected field. * means it will be included in the image, while M means that it will only create a package for it, which kind of defeats the point of following this guide.
Except for choosing the target I suggest that you don't mess with the options above Base system. Also, in general, don't uncheck anything that is selected by default unless you really know what you're doing. If something is selected with “-*-” (so you can't uncheck it) it is because something else depends on it.
Instructions on how to include config files in the image (for instance from the backup you can download from the router): Custom files
when you have selected what you want. This will take a very long the first time. Don't use the -j option mention in the Quick image building guide, it is asking for trouble.
If it completes without errors you should now have images. If not then try running
make -j1 V=s
to get more details about the error. A common mistake is to include packages that are mutually exclusive. After a successful build you can list the generated files using this command:
ls -l bin/targets/*/*/
Copy the image files to your shared Windows path:
sudo cp bin/targets/*/*/* /media/sf_Shared
Important: Make sure the image is at least about 500 KB less than the total amount of flash ROM, as some space is needed for configuration and other data. The absolute limit will vary depending on router model and how much configuration data you want to store. You can get an indication by being on the safe side the first time, and then check how much free space there is when you have installed it.
To erase just the config:
To check out a different version:
rm -rf ~/openwrt/
the follow part 2 of the guide from the start, except you can skip the sudo apt-get commands.