Version 27 (modified by amain, 8 years ago) (diff)

--

SVN HTTP Repository Access

To checkout the DebWrt build environment, use:

svn checkout https://svn.debwrt.net/debwrt/trunk debwrt

Known fingerprint of the https server {{{ 15:dd:03:49:ee:63:0f:1c:a8:e3:8e:24:20:cc:1c:25:24:75:c4:ce }}}

The DebWrt build environment has been developed and tested on Ubuntu. However I do expect that building on other Linux distributions should work.

Much more information on using the DebWrt build environment will follow.

Pre-requisites

  • Kernel:
    • make openwrt/all will give a list of dependencies
      • flex
      • git
  • Root filesystem & Cross compile environment:
    • debootstrap, comes with any Debian or Ubuntu versions
    • run as normal user
    • gid of the normal user must be >= 1000
    • uid of the normal user must be >= 1000
    • this normal user must have sudo rights - for example: amain ALL=(ALL) NOPASSWD: ALL
    • debian packages
      • subversion
      • build-essentails
      • libncurses5-dev
      • fakeroot
      • chroot

Do it all in one turn

  • make menuconfig
  • make V=99

Detailed build instructions

Kernel compile

  • make menuconfig
    • Select your target device type
    • And that should be it
  • ( optional ) make openwrt/menuconfig
  • make openwrt/all V=99
  • binaries in bin/
  • follow instructions on OpenWrt how to flash the firmware to your specific device

Root filesystem creation: Stage 1

  • Preferably compile a kernel first, but this is not necessary ( hmm, rereading this now: it might be better to compile openwrt kernel first. Not sure if this still works :-) )
  • Make sure you have full sudo rights, preferably without the need for typing a password
  • All work is done in a chroot jail to prevent messing up the host root filesystem
  • make menuconfig
    • Select your target device type
    • Optional: selection Debian version
  • make debian/rootfs
  • make debian/rootfs/modules-install
  • rootfs in: build/rootfs-<ARCH>-<DEBWRT_RELEASE>-<DEBWRT_VERSION>-<RELEASE>/
  • install by copying manually or:
    • mount your USB Disk/USB Stick/SD Card/CF Card/IDE/SATA root partition with ext3 on /media/DEBWRT_ROOT
    • make debian/rootfs/install
    • it will install the rootfs in /media/DEBWRT_ROOT ( an rm -rf is done first! )
  • continue with stage 2

Root filesystem creation: Stage 2

Stage one prepared a filesystem with debootstrap. A DebWrt Debian root filesystem for the selected architecture(mips, mipsel, ...) has been created. It includes a default Debian installation with some important DebWrt cross-compiled packages installed. Flash the device with the appropriate DebWrt kernel. Boot the device. It will boot in 'firstboot' mode. When having a serial port, one will be able to immediately follow progress and see bash starting with some instructions. Otherwise connect to the device using ssh. Basically what needs to be done after logging in, is the debootstrap second stage install, which will install all Debian packages properly. This is a step that can not be done on the build host, because of the architecture mismatch. (I invested a lot of time in QEMU, but QEMU is not reliable for MIPS and MIPSEL. ARM works fine with QEMU )

When using SSH, the post-install instructions will not appear. Therefore see the instructions below which come from debwrt/trunk/debian/rootfs/files/init.d/rcS.firstboot:

/bin/echo
/bin/echo "Welcome to the DebWrt post installation!"
/bin/echo
/bin/echo "Press ctrl-d for normal boot. Use vim.tiny to edit files."
/bin/echo
/bin/echo "Note that both telnetd and sshd are running on: 192.168.1.1 and on 192.168.1.20."
/bin/echo
/bin/echo "Second stage install instructions:"
/bin/echo
/bin/echo "- /debootstrap/debootstrap --second-stage"
/bin/echo "- rm -rf /var/cache/apt/archives"
/bin/echo "- mkdir -p /var/cache/apt/archives/partial"
/bin/echo "- echo \"deb http://ftp.debian.org/debian squeeze main\" >>/etc/apt/sources.list"
/bin/echo "  OR"
/bin/echo "- echo \"deb http://ftp.debian.org/debian sid main\" >>/etc/apt/sources.list"
/bin/echo "- for Lenny: dpkg-reconfigure dash"
/bin/echo
/bin/echo " Don't execute these lines, these are a reminder for myself(amain) when preparing an DebWrt release:"
/bin/echo "- rm -rf /lib/modules/*"
/bin/echo "- rm -rf /lib/firmware/*"
/bin/echo

Root filesystem image information

See DebWrtRootfsImageInformation for default IP address, password, installed packages, etc.

How to use the Emdebian based cross-compile environment

  • Preferably compile a kernel first, but this is not necessary
  • Make sure you have full sudo rights, preferably without the need for typing a password
  • All work is done in a chroot jail to prevent messing up the host root filesystem
  • make menuconfig
    • Select your target device type
    • Optional: selection Debian version
  • make debian/buildenv
  • make chu - enter chroot as normal user
  • make ch - enter chroot as root
  • make debian/package/all - build all packages
  • make debian/package/XX - build a specific package
  • make debian/package/XX/clean - clean up a specific package

note: have a look in the Makefiles, there are a lot more Makefile targets ( pre setup commands ) available doing all kinds of handy stuff.