A Few Things About OpenWRT Compilation
I encountered some issues during OpenWRT compilation that are worth documenting.
Let me answer a few questions first
- Why compile it myself? I’m a mature computer science student (lol).
- Why use Github Actions? Because Github is really convenient
I originally wanted to use my dedicated AMD 9950X as the build machine, but it failed after 15 minutes and I was too lazy to troubleshoot - Why can’t I understand this?
If you don’t understand, don’t read it.Just download pre-compiled packages from others.
The following is based on the latest OpenWRT (23.05) + Github Actions online compilation
1. Preparation#
Clone the repository locally#
First, you need to Fork the LEDE source code. LEDE repository [Github][1]
Clone the repository you just forked to your local machine:
git clone https://github.com/your-username/lede
bashDon’t download ZIP! The ZIP file is not a Git repository and doesn’t contain the
.git
folder, so you can’t usegit
commands on it.
Update Feeds#
cd lede
./scripts/feeds update -a
./scripts/feeds install -a
plaintextIf you don’t update the feeds, you won’t see Luci apps later! This step is mandatory!
Enter the configuration menu#
Use the following command to enter the configuration menu:
make menuconfig
bashConfiguration menu explanation#
Generally, you only need to modify these:
- Target System: Processor architecture
- Subtarget: Select processor
- Target Profile: Preconfigured profile
- LuCI: LuCI plugins
- Applications: Applications
- Themes: Themes
For example, I selected:
- Target System: Mediatek-ARM
- Subtarget: Filogic
- Target Profile: ASR3000
- LuCI: LuCI plugins
- Applications: Many fun plugins for you to explore!
- Themes: luci-theme-material
After making changes, select Save
to save as a .config
file.
For Luci plugins, please refer to [this article on the Enshan forum][2]
Commit to your forked repository#
-
Delete the
/.config
line in the.gitignore
file to stop ignoring the config file. Very important!!! Otherwise, the.config
file won’t be included when youcommit
!!! -
Commit changes to GitHub:
git add .
git commit -m "upd: personal config"
git push origin master
bashThe branch is called master, has a master-servant flavor to it
Pitfalls:#
Enable WIFI before compilation#
If you need to enable WIFI by default for easy management, I searched many tutorials online but they were useless, mostly from around 2015 with no reference value. I figured it out myself:
Go to the package/lean/default-settings/files/
directory, edit the file zzz-default-settings
Comment out these two lines by adding #
at the beginning:
sed -i '/option disabled/d' /etc/config/wireless
sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh
shGithub Actions Compilation#
Online guides still say “submit a Release and it will automatically trigger Github Actions” but that didn’t work for me, so I needed to make some changes:
-
When using Github Actions for compilation, remember to go to the Workflow page and enable the Workflow, and also enable OpenWrt-CI (because Workflows in forked repositories are disabled by default)
-
Also modify the repository’s
.github/workflows/openwrt-ci.yml
, changing thecron
task at the beginning (line 10) to the following to allow manual workflow triggering:
plaintexton: repository_dispatch: workflow_dispatch:
It will take about two hours, but what does that have to do with me since I’m using Github’s resources
Modifying various miscellaneous settings#
- Change the default theme
plaintextsed -i "s/luci-theme-bootstrap/luci-theme-material/g" feeds/luci/collections/luci/Makefile
(Nowadays people's aesthetics seem to prefer the argon theme, anyway this should match what you installed in the `luci-themes` section of your `.config`)
- Add compiler information
plaintextsed -i “s/OpenWrt /TheUnknownThing build $(TZ=UTC-8 date ”+%Y.%m.%d”) @ OpenWrt /g” package/lean/default-settings/files/zzz-default-settings
You probably don't want to keep "TheUnknownThing" as your builder name, change it to something else.
- Modify the default management address
The default management address is `192.168.1.1`, if it conflicts with your upstream network segment, you can modify it
plaintextsed -i ‘s/192.168.1.1/192.168.2.1/g’ package/base-files/files/bin/config_generate
This changes it to `192.168.2.1`
[1]: https://github.com/coolsnowwolf/lede
[2]: https://www.right.com.cn/forum/thread-3682029-1-1.html
plaintext