I usually compile Openwrt & LEDE in Ubuntu 16.04 x64 running in Virtualbox inside my Windows PC. But I wanted to test if the new Windows 10 feature of a built-in embedded Linux subsystem is powerful enough to compile Openwrt.
The feature is part of the 1607 Anniversary Update for Windows 10 Pro+, but not Home. Basically the feature shows up as an Ubuntu bash shell. It even allows you to install new packages via "sudo apt-get install" like you would do in a normal Ubuntu computer.
To my surprise things actually worked pretty well. Openwrt (or actually LEDE) trunk firmware got compiled ok and my ar71xx/WNDR3700 router is happily running that firmware now. So, it is possible to compile Openwrt in Windows without needing to use Virtualbox etc. to get the needed Linux.
Key observations in case somebody else wants to try the same:
Native Windows NTFS disks are available in /mnt/c, /mnt/d etc. However, they have limitations for the allowed filenames: apparently ":" is a forbidden character, so cloning Openwrt sources to a native NTFS partition will fail due to e.g. wwan and usbmode packages that have files with : in the name. Similarly the file permissions defaults to chmod 777, which will not work for Openwrt buildroot.
The subsystem creates a new Linux rootfs in the Windows user's Appdata\local dir ( C:\Users\<username>\AppData\Local\lxss ). There ":" is allowed for filenames as the filename handling seems to contain some conversion logic. Same goes also for file/dir permissions that work Linux-wise and allow other than 777.
In practice that means that the Openwrt buildroot needs to be created on the system drive into the user profile of the Windows user. That might be unwanted in some situations, e.g. depending on the backup strategies.
The needed prerequisite packages list almost matched the normal Ubuntu x64 requirements. The only surprise was that "unzip" needed to be installed separately. I have never installed that on normal Ubuntu, but it seems to be missing from the default packages in the Windows Linux subsystem. But "sudo apt-get install unzip" fixed that.
Otherwise the compilation was straightforward and even my own buildscripts worked perfectly.
Personally I will continue to use Virtualbox to host Ubuntu, as that allows me to have the files elsewhere than the system drive. But in any case, the "Linux in Windows" feature works ok for Openwrt compilation.
I did not test it, but likely also the Openwrt imagegenerator would work ok.
Key steps to compile Openwrt inside Windows 10's embedded Linux:
Install & enable Linux subsystem for Windows 10. First change Windows 10 to "Developer mode" in System Settings to allow advanced development features. Then enable the "Windows subsystem for Linux (beta)" in the Windows programs&features selection. From a normal CMD command prompt issue the command "bash" to get the Linux subsystem installed and launched. The installation process also asks you to set a Linux username for the shell. Note that for Openwrt that needs to be something else than "root".
In the bash shell, install the pre-requisites:
sudo apt-get install unzip
sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev
sudo apt-get install gawk gcc-multilib flex git-core gettext libssl-devCreate a directory for the Openwrt buildroot to the / of the Linux subsystem rootfs, and chown & chmod the dir suitably. ("perus" is my non-root username):
sudo mkdir /ow
sudo chown perus /ow
sudo chmod 755 /owClone sources, change to directory, update feeds. The buildroot will be in /ow/openwrt :
cd /ow
git clone https://github.com/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -aNormal config & make:
make menuconfig
make
(Last edited by hnyman on 16 Oct 2016, 14:09)