Debian Environment Prepare - vanaware/openwrt GitHub Wiki

Instructions on how to create the compile environment on debian 64bits machine to Compile LEDE or Openwrt

Pre-requisites

  • 64bits Debian or Ubuntu Machine

Create an LXC container

Create a dev environment using an LXC container with Debian:

sudo lxc-create -t debian -n openwrt
sudo lxc-stop -n openwrt --kill
sudo chroot /var/lib/lxc/openwrt/rootfs
apt-get update
apt-get install sysvinit-core curl nano
exit
echo "lxc.aa_profile = unconfined" | sudo tee -a /var/lib/lxc/openwrt/config

To run some command you can do:

sudo lxc-start -d -n openwrt
sudo lxc-attach -n openwrt -- apt-get update

To have a full terminal you can do (user root password root):

sudo lxc-start -d -n openwrt
sudo lxc-console -n openwrt -t 1

Prepare the LXC container

Make some adjustments inside LXC container

nano /etc/apt/sources.list
deb [arch=amd64] http://http.debian.net/debian          stable         main contrib non-free
deb [arch=amd64] http://http.debian.net/debian          unstable         main contrib non-free
deb [arch=amd64] http://security.debian.org/ stable/updates main contrib non-free
deb-src http://ftp.br.debian.org/debian/ stable main contrib non-free
deb-src http://ftp.br.debian.org/debian/ unstable main contrib non-free
nano /etc/apt/preferences.d/main
Package: * 
Pin: release a=stable 
Pin-Priority: 900

Package: *
Pin: release a=stretch
Pin-Priority: 600

Package: * 
Pin: release a=unstable 
Pin-Priority: 100
nano /etc/apt/apt.conf.d/70debconf
// Pre-configure all packages with debconf before they are installed.
// If you don't like it, comment it out.
DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt || true";};
APT::Default-Release "stable";
apt-get update 
apt-get install build-essential libncurses5-dev gawk git subversion libssl-dev gettext unzip zlib1g-dev file python wget g++ rsync man-db git-email gcc-multilib flex git-core mercurial binutils bzip2 gcc util-linux tar make genisoimage quilt 
cat > ~/.quiltrc <<EOF
QUILT_DIFF_ARGS="--no-timestamps --no-index -p ab --color=auto"
QUILT_REFRESH_ARGS="--no-timestamps --no-index -p ab"
QUILT_SERIES_ARGS="--color=auto"
QUILT_PATCH_OPTS="--unified"
QUILT_DIFF_OPTS="-p"
EDITOR="nano"
EOF