OpenWRT Build System for CentOS 7: Difference between revisions

Created page with "How does one create a "build system" (AKA Cross Compile / Cross-Compile / CrossCompile Build System) for OpenWRT? There are lots of tutorials; * General Guide for building f..."
 
mNo edit summary
Line 1: Line 1:
How does one create a "build system" (AKA Cross Compile / Cross-Compile / CrossCompile Build System) for OpenWRT? There are lots of tutorials;
How does one create a "build system" (AKA Cross Compile / Cross-Compile / CrossCompile Build System) for OpenWRT?


* General Guide for building firmware: https://openwrt.org/docs/guide-user/additional-software/beginners-build-guide
== Other Tutorials ==
** Start of detailed Information: https://openwrt.org/docs/guide-developer/build-system/start
** Pre-requisites for a : https://openwrt.org/docs/guide-developer/build-system/install-buildsystem
** Some additional granular detail for working with specific versions: https://openwrt.org/docs/guide-developer/build-system/use-buildsystem
* Build environment tips: https://openwrt.org/docs/guide-developer/env
* SDK (for compiling specific packages): https://openwrt.org/docs/guide-developer/using_the_sdk
** URL for SDK (look towards the bottom of the page for SDK): https://downloads.openwrt.org/releases/19.07.3/targets/mvebu/cortexa9/
* Third Party Site with nice information (Old, but this article itself notes even older OpenWRT documentation): http://www.acme-dot.com/building-openwrt-14-07-barrier-breaker-on-ubuntu-and-os-x/ (Don't follow the instructions as it GIT won't work anymore with non-SSL URLs)
* Entware Tips (The don't apply directly, but have some good tips if read from the context of OpenWRT)
** Native Compilation: https://github.com/Entware/Entware-ng/wiki/Using-gcc-%28native-compilation%29
** Compiling Packages from Source: https://github.com/Entware/Entware-ng/wiki/Compile-packages-from-sources
** Creating Perl modules: https://github.com/Entware/Entware-ng/wiki/Self-installation-of-perl-modules


This is my version.
*General Guide for building firmware: https://openwrt.org/docs/guide-user/additional-software/beginners-build-guide
**Start of detailed Information: https://openwrt.org/docs/guide-developer/build-system/start
**Pre-requisites for a : https://openwrt.org/docs/guide-developer/build-system/install-buildsystem
**Some additional granular detail for working with specific versions: https://openwrt.org/docs/guide-developer/build-system/use-buildsystem
*Build environment tips: https://openwrt.org/docs/guide-developer/env
*SDK (for compiling specific packages): https://openwrt.org/docs/guide-developer/using_the_sdk
**URL for SDK (look towards the bottom of the page for SDK): https://downloads.openwrt.org/releases/19.07.3/targets/mvebu/cortexa9/
*Third Party Site with nice information (Old, but this article itself notes even older OpenWRT documentation): http://www.acme-dot.com/building-openwrt-14-07-barrier-breaker-on-ubuntu-and-os-x/ (Don't follow the instructions as it GIT won't work anymore with non-SSL URLs)
*Entware Tips (The don't apply directly, but have some good tips if read from the context of OpenWRT)
**Native Compilation: https://github.com/Entware/Entware-ng/wiki/Using-gcc-%28native-compilation%29
**Compiling Packages from Source: https://github.com/Entware/Entware-ng/wiki/Compile-packages-from-sources
**Creating Perl modules: https://github.com/Entware/Entware-ng/wiki/Self-installation-of-perl-modules


Details of objectives, etc.
== Environment ==


* OpenWRT 19.07.03 (Linux Kernel 4.14.180)
*Build System for Cross-Compiling: CentOS 7.8 (There seem to be some missing packages in CentOS 8, so CentOS 7.8 was chosen)
* Linksys WRT3200ACM Platform Information (see [[WRT1900AC, WRT1900ACS, and WRT3200ACM Routers, SoS ( CPU ), and Hardware|here]] for additional information)
*OpenWRT 19.07.03 (Linux Kernel 4.14.180)
** Marvell Armada 385 88F6820 SoS (System on a Chip)
*Linksys WRT3200ACM Platform Information (see [[WRT1900AC, WRT1900ACS, and WRT3200ACM Routers, SoS ( CPU ), and Hardware|here]] for additional information)
** Manufacturer: Marvell, MVEBU (Marvell Embedded Business Unit)
**Marvell Armada 385 88F6820 SoS (System on a Chip)
** CPU Information
**Manufacturer: Marvell, MVEBU (Marvell Embedded Business Unit)
*** ARM Family: Cortex-A (32-bit)
**CPU Information
*** ARM Architecture: ARMv7-A
***ARM Family: Cortex-A (32-bit)
*** ARM Core: Cortex-A9
***ARM Architecture: ARMv7-A
*** OpenWRT Target and Package Details
***ARM Core: Cortex-A9
**** MVEBU (Marvell Embedded Business Unit)
***OpenWRT Target and Package Details
***** Targets Available: cortexa53, cortexa72, '''cortexa9'''
****MVEBU (Marvell Embedded Business Unit)
*** Equivalent DD-WRT / Entware Target and Package reference
*****Targets Available: cortexa53, cortexa72, '''cortexa9'''
**** ARMv7sf-k3.2: ARM version 7 with linux kernel 3.2
*****Marvell Armada 37x/38x/XP (Armada 3700LP and Armada 7k/8k are 64 bit versions)
** Sources:
***Equivalent DD-WRT / Entware Target and Package reference
*** https://en.wikipedia.org/wiki/List_of_ARM_microarchitectures
****ARMv7sf-k3.2: ARM version 7 with linux kernel 3.2
*** https://en.wikipedia.org/wiki/ARM_Cortex-A9
**Sources:
*** http://bin.entware.net/mipselsf-k3.4/
***https://en.wikipedia.org/wiki/List_of_ARM_microarchitectures
***https://en.wikipedia.org/wiki/ARM_Cortex-A9
***http://bin.entware.net/mipselsf-k3.4/


There seem to be some missing packages in CentOS 8, so CentOS 7.8 was chosen for this project.
== 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 <nowiki>https://github.com/openwrt/openwrt.git</nowiki> (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/ and ~/openwrt/feeds/packages/admin
* Checkout (not needed if a single branch like 19.07 is downloaded)
** git checkout openwrt-19.07 (if multiple branches have been downloaded, switch to using this one)
** Oddly, this command is documented using the latest version of OpenWRT as of 9.2020, but it doesn't work as expected: git checkout v19.07.03 (from https://openwrt.org/docs/guide-developer/build-system/use-buildsystem)
* SDK
** Download the SDK and uncompress it (which is equivalent to the ''git clone'' command above)
*** URL for SDK (look towards the bottom of the page for SDK): https://downloads.openwrt.org/releases/19.07.3/targets/mvebu/cortexa9/
*** Don't worry about the name ending in x86_64 as this indicates the platform that the cross compiling will take place on.
** tar xf WhatEverFileName (be sure one is in the ~ directory)
** ./scripts/feeds update -a
** ./scripts/feeds install WhatEverPackageName
* Package Building
** Sources
*** https://openwrt.org/docs/guide-developer/package-policies
*** https://openwrt.org/docs/guide-developer/packages
** Using the full TAR package as an example
*** make menuconfig
*** disable all the Global settings to "build all"
*** Utilities (look in the Makefile file in the define Package/tarcustom (or WhatEverName) for where the package will be)
** Copy the ~/openwrt/package/feeds/packages/tar/Makefile
** Edit the PKG_SOURCE
* Headers
** Potential Locations;
*** ~/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/linux-mvebu_cortexa9/linux-4.14.195/user_headers/include
** Sources
*** https://forum.openwrt.org/t/how-to-obtain-headers-for-openwrts-kernel/50737/6
*** https://openwrt.org/docs/guide-developer/packages
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<br />