OpenWRT Build System for CentOS 7

Wiki.TerraBase.info
Jump to navigation Jump to search

How does one create a "build system" (AKA Cross Compile / Cross-Compile / CrossCompile Build System) for OpenWRT?

Other Tutorials

Environment

  • Build System for Cross-Compiling: CentOS 7.8 (There seem to be some missing packages in CentOS 8, so CentOS 7.8 was chosen)
  • OpenWRT 19.07.03 (Linux Kernel 4.14.180)
  • Linksys WRT3200ACM Platform Information (see here for additional information)

Steps (as of 9.2020 for the above Environment)

All of the below assumes one is storing files in the user's home directory.

OpenWRT recommends NOT compiling as a root users. To bypass this restriction;

  • export FORCE_UNSAFE_CONFIGURE=1 (the export command adds the variable to the current user session, it will not persist if logging off, confirm with printenv or export -p)

Obtain Source Files from OpenWRT

  • git clone -b openwrt-19.07 https://github.com/openwrt/openwrt.git (downloads the 19.07 branch of OpenWRT, which also includes the latest version, 19.07.03)
    • To see repository, in web browser: https://git.openwrt.org/openwrt/
    • git tag (essentially shows available versions to build)
    • git branch (shows local versions of OpenWRT downloaded)
    • git branch -r (shows versions available for download)
  • Feeds
    • Documentation: https://openwrt.org/docs/guide-developer/feeds
    • ~/openwrt/feeds.conf.default
    • ./scripts/feeds update -a (A script from OpenWRT to makes sure all files are up to date)
    • ./scripts/feeds (by itself, no "sub-commands", shows available options)
    • ./scripts/feeds list -n (shows main categories of feeds)
      • Should show these Names: packages, luci, routing, and telephony
    • ./scripts/feeds list -r OneOfTheFeedNames (shows the available packages, names are equivalent to what would be found with opkg list)
    • Example: ./scripts/feeds install htop (an enhanced version of top)
      • Files will be downloaded here: ~/openwrt/package/feeds/packages/, which are symbolic links to: ~/openwrt/feeds/packages/admin
  • Checkout (not needed if a single branch like 19.07 is downloaded)
  • SDK
    • Download the SDK and uncompress it (which is equivalent to the git clone command above)
    • tar xf WhatEverFileName (be sure one is in the ~ directory)
    • ./scripts/feeds update -a
    • ./scripts/feeds install WhatEverPackageName
  • Package Building
  • Headers