Difference between revisions of "OpenWRT: Build Firmware"
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
Line 167: | Line 167: | ||
* [[OpenWRT: Build Firmware]] | * [[OpenWRT: Build Firmware]] | ||
* [[OpenWRT: Build Firmware Buffalo WZRHPG450H]] | * [[OpenWRT: Build Firmware Buffalo WZRHPG450H]] | ||
+ | * [[OpenWRT: Build Firmware Ubiquiti NanoStation2]] | ||
* [[UBNT]] | * [[UBNT]] |
Revision as of 15:51, 24 July 2012
WARNING: ini akan membutuhkan banyak akses ke Internet untuk download, termasuk waktu proses make. Termasuk download kernel linux, waktu compile toolchain :( ... Tampaknya tidak bisa OFFLINE :(
Sumber:
- https://forum.openwrt.org/viewtopic.php?id=15201
- http://wiki.openwrt.org/doc/howto/build
- http://downloads.openwrt.org/docs/buildroot-documentation.html
Prosedur
- Lakukan sebagai non-root user
- Lakukan semua perintah di <buildroot dir> misalnya ~/openwrt/trunk/
- Update OpenWrt source
- Update & install package feeds.
- Configure build.
- Start build. Ini akan secara automatis compile Ttoolchain, cross-compile sources, package packages, dan generate image siap untuk di flashed.
- Proceed to Installing OpenWrt
Persiapan
Lakukan
sudo su apt-get update apt-get install subversion gawk flex sharutils bison libz-dev patch fakeroot lzma
Menggunakan SVN
Sebagai user biasa lakukan
svn co svn://svn.openwrt.org/openwrt/branches/backfire ~/openwrt/trunk/ cd ~/openwrt/trunk/ ./scripts/feeds update ./scripts/feeds install <pkg_name_1> <pkg_name_2> ... <pkg_name_N> make defconfig make menuconfig make world
Update SVN
cd ~/openwrt/trunk/ svn update ./scripts/feeds update
Menggunakan GIT
git clone git://nbd.name/openwrt.git ~/openwrt/trunk/ cd ~/openwrt/trunk/ ./scripts/feeds update # You have to change feeds.conf to use the git packages repo. See the patch below. ./scripts/feeds install <pkg_name_1> <pkg_name_2> ... <pkg_name_N> # After installing the package (creates the symlink for you, you can select it in menuconfig) make menuconfig # Choose your Target System/Subtarget/Target Profile and select packages/features make world
Update GIT
cd ~/openwrt/trunk/ git pull ./scripts/feeds update
Tips
You should specify which chipset you are using. But on your target/linux/chipname/, there should be a makefile that tells you which build you are supposed to build.
For my case it was in kamikaze/target/linux/atheros/Makefile.
LINUX_VERSION:=2.6.23.17 <-- just change this to whatever is your rev is you probably need to know the subversion.
Building on multi-core CPU
The build process can be accelerated by running multiple concurrent job processes using the -j-option:
make -j 3
Use the standard formula <your number of CPUs + 1> If this produces random build errors try compiling again without the -j-option
Building in the background
If you intend to use your system while building, you can have the build process use only idle I/O and CPU capacity like this (dualcore CPU):
ionice -c 3 nice -n 20 make -j 2
Building single Packages
When developing or packaging software for OpenWrt, it is convenient to be able to build only the package in question (e.g. with package cups):
make package/cups/compile V=99
For the package mc (midnight commander), which is contained the feed packages it looks like this:
make package/feeds/packages/mc/compile v=99
Spotting build errors
If for some reason the build fails, the easiest way to spot the error is to do:
make V=99 2>&1 | tee build.log | grep -i error
The above saves a full verbose copy of the build output (with stdout piped to stderr) in /openwrt/trunk/build.log and only shows errors on the screen.
Another example:
ionice -c 3 nice -n 20 make -j 2 V=99 CONFIG_DEBUG_SECTION_MISMATCH=y 2>&1 | tee build.log | egrep -i '(warn|error)'
The above saves a full verbose copy of the build output (with stdout piped to stderr) in build.log and outputs only warnings and errors while building using only background resources on a dual core CPU. Getting beep notification
Depending on your CPU, the process will take a while, or while longer. If you want an acoustic notification, you could use echo -e '\a':
make V=99 ; echo -e '\a'
Locating Images
Jika berhasil image yang kita buat akan berada di bawah directory
<buildroot dir>/bin
Jika kita buat firmware untuk ar71xx maka ada di bawah
<buildroot dir>/bin/ar71xx directory.
Jika <buildroot dir> adalah /openwrt/trunk, maka binary ada di
/openwrt/trunk/bin/ar71xx.
Cleaning Up
You might need to clean your build environment every now and then. The following make-targets are useful for that job:
Clean
make clean
deletes contents of bin and build_dir directories.
Dirclean
make dirclean
deletes contents of /bin and /build_dir directories and additionally /staging_dir and /toolchain (=the cross-compile tools). 'Dirclean' is your basic "Full clean" operation.
Distclean
make distclean
nukes everything you have compiled or configured and also deletes all downloaded feeds contents and package sources.
CAUTION: In addition to all else, this will erase your build configuration (.config), your toolchain and all other sources. Use with care!
There are numerous other functionalities in the OpenWrt build system, but the above should have covered some of the fundamentals.
Referensi
- https://forum.openwrt.org/viewtopic.php?id=15201
- http://wiki.openwrt.org/doc/howto/build
- http://downloads.openwrt.org/docs/buildroot-documentation.html