Difference between revisions of "OpenWRT: Build Firmware"

From OnnoWiki
Jump to navigation Jump to search
 
(35 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
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:
 
Sumber:
 
* https://forum.openwrt.org/viewtopic.php?id=15201
 
* https://forum.openwrt.org/viewtopic.php?id=15201
 
* http://wiki.openwrt.org/doc/howto/build
 
* http://wiki.openwrt.org/doc/howto/build
 
* http://downloads.openwrt.org/docs/buildroot-documentation.html
 
* http://downloads.openwrt.org/docs/buildroot-documentation.html
 +
 +
 +
==Prosedur==
 +
 +
* Lakukan pada komputer yang mempunya harddisk free 30Gbyte
 +
* Yang aman menggunakan Sistem Opersi Ubuntu 10.10, Ubuntu 12.04 entah kenapa sering gagal compile.
 +
* Lakukan sebagai non-root user
 +
* Lakukan semua perintah di <buildroot dir> misalnya ~/openwrt/trunk/
 +
* Sebaiknya lakukan dari fresh source code. Jadi buang terlebih dahulu <buildroot dir>, kemudian refresh dari sumber di [[Internet]].
 +
* 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.
 +
* Lakukan instalasi OpenWrt
 +
 +
==Persiapan==
 +
 +
Lakukan
 +
 +
sudo su
 +
apt-get update
 +
apt-get install subversion gawk flex sharutils bison libz-dev patch fakeroot lzma git-core build-essential
  
 
==Menggunakan SVN==
 
==Menggunakan SVN==
  
  svn checkout https://svn.openwrt.org/openwrt/trunk/ ~/trunk/
+
Sebagai user biasa lakukan
  cd ~/trunk/
+
 
 +
  svn co svn://svn.openwrt.org/openwrt/branches/backfire ~/openwrt/trunk/
 +
  cd ~/openwrt/trunk/
 
  ./scripts/feeds update
 
  ./scripts/feeds update
  ./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)
+
  ./scripts/feeds install <pkg_name_1> <pkg_name_2> ... <pkg_name_N>
  make menuconfig # Choose your Target System/Subtarget/Target Profile and select packages/features
+
make defconfig
 +
  make menuconfig
 
  make world
 
  make world
  
 
===Update SVN===
 
===Update SVN===
  
  cd ~/trunk/
+
  cd ~/openwrt/trunk/
 
  svn update
 
  svn update
 
  ./scripts/feeds update
 
  ./scripts/feeds update
 
  
 
==Menggunakan GIT==
 
==Menggunakan GIT==
  
  git clone git://nbd.name/openwrt.git ~/trunk/
+
  git clone git://nbd.name/openwrt.git ~/openwrt/trunk/
  cd ~/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 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)
 
  ./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)
Line 31: Line 59:
 
===Update GIT===
 
===Update GIT===
  
  cd ~/trunk/
+
  cd ~/openwrt/trunk/
 
  git pull
 
  git pull
 
  ./scripts/feeds update
 
  ./scripts/feeds update
  
  
 +
==Download Source Code==
 +
 +
Yang akan membuat lama & frustasi adalah download source yang akan di compile dari nol.
 +
Terutama
 +
 +
80MB http://launchpad.net/gcc-linaro
 +
60MB ftp://ftp.all.kernel.org/pub/linux/kernel/v3.x/
  
 
==Tips==
 
==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.
+
Kita dapat menentukan / menset chipset mana yang akan kita gunakan.  
 +
Di target/linux/chipname/, ada makefile yang mengatakan kernel mana yang akan dibuat, contoh di Kamikaze tepatnya kamikaze/target/linux/atheros/Makefile.
 +
 
 +
LINUX_VERSION:=2.6.23.17
 +
 
 +
Ubah ini sesuai dengan subversion yang anda inginkan.
 +
 
 +
==Build di multi-core CPU==
 +
 
 +
Proses build dapat di percepat dengan menjalankan beberapa concurrent job process mengunakan option -j seperti
 +
 
 +
make -j 3
 +
 
 +
Gunakan standard formula <jumlah CPU + 1>. Jika cara ini menyebabkan error saat build, coba compile tanpa option -j.
 +
 
 +
 
 +
==Build di background==
 +
 
 +
Jika anda ingin menggunakan sistem / mesin anda waktu anda build, kita dapat membuat proses build hanya menggunakan I/O dan kapasitas CPU yang ide, contoh untuk CPU dualcore:
 +
 
 +
ionice -c 3 nice -n 20 make -j 2
 +
 
 +
==Build  single Packages==
 +
 
 +
Saat kita melakukan developing atau packaging software untuk OpenWrt, akan lebih memudahkan jika kita dapat membuat untuk package yang kita inginkan saja (misalnya untuk package cups):
 +
 
 +
make package/cups/compile V=99
 +
 
 +
Untuk  package mc (midnight commander), yang kebetulan berada feed packages perintahnya akan seperti
 +
 
 +
make package/feeds/packages/mc/compile v=99
 +
 
 +
==Melihat build errors==
 +
 
 +
Jika build gagal, cara yang paling gampang untuk melihat error adalah melalui perintah
 +
 
 +
make V=99 2>&1 | tee build.log | grep -i error
 +
 
 +
Perintah di atas akan menyimpan copy full verbose dari output build (dengan stdout di pipe ke stderr) di /openwrt/trunk/build.log dan hanya memperlihatkan error saja ke screen
 +
 
 +
Contoh lain
 +
 
 +
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)'
 +
 
 +
Cara di atas menyimpan copy full verbose dari output build (dengan stdout di pipe ke stderr) di build.log dan akan mengeluarkan hanya warning dan error saat building menggunakan resource background di dual core CPU.
 +
 
 +
==Notifikasi Beep==
 +
Tergantung pada CPU yang kita gunakan, proses build akan memakan waktu sebentar, atau lama. Jika kita menginginkan notifikasi suara, kita dapat menggunakan 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==
 +
 
 +
Kadang kita ingin membersihkan lingkungan build. Contoh berikut akan sangat berguna,
 +
 
 +
===Clean===
 +
 
 +
Delete isi bin dan directory build_dir
 +
 
 +
make clean
 +
 
 +
===Dirclean===
  
For my case it was in kamikaze/target/linux/atheros/Makefile.
+
make dirclean
  
LINUX_VERSION:=2.6.23.17 <-- just change this to whatever is your rev is you probably need to know the subversion.
+
Delete isi /bin dan /build_dir directory juga /staging_dir dan /toolchain (=cross-compile tool). 'Dirclean' adalah untuk memperoleh "Full clean".
  
 +
atau dipaksa banget dengan
  
 +
make FORCE=1 dirclean
  
 +
===Distclean===
  
 +
make distclean
 +
 +
Hancurkan semua yang pernah kita compile atau configure dan delete semua content feed dan package source yang pernah kita download.
 +
 +
PERHATIAN: Perintah ini akan menghapus build configuration (.config).
  
 
==Referensi==
 
==Referensi==
Line 58: Line 176:
  
 
* [[OpenWRT]]
 
* [[OpenWRT]]
 +
* [[OpenWRT: Download Firmware yang sudah jadi]]
 
* [[OpenWRT: Source Repository Download]]
 
* [[OpenWRT: Source Repository Download]]
 +
* [[OpenWRT: Melihat Daftar Package]]
 +
 +
===Build Firmware===
 +
 
* [[OpenWRT: Build Firmware]]
 
* [[OpenWRT: Build Firmware]]
 +
* [[OpenWRT: Build Firmware Download Source Pendukung]]
 +
* [[OpenWRT: Build Firmware Buffalo WZRHPG450H]]
 +
* [[OpenWRT: Build Firmware Buffalo WZRHPG300N]]
 +
* [[OpenWRT: Build Firmware Buffalo WZRHPG300NH2]]
 +
* [[Buffalo]]
 +
* [[Buffalo: WZRHPG450H Cara Recovery]]
 +
* [[Buffalo: WZRHPG450H OpenWRT mengaktifkan setelah di flash]]
 +
* '''[[Buffalo: WZRHPG450H Membuat Firmware OpenWRT Sendiri]]''' '''RECOMMENDED'''
 +
* [[Buffalo: WZRHPG450H OpenWRT instalasi aplikasi Pendukung OLSRD]]
 +
* [[OpenWRT: Build Firmware Ubiquiti NanoStation2]] '''RECOMMENDED'''
 +
* [[OpenWRT: Build Firmware Ubiquiti NanoStationM2]] '''RECOMMENDED'''
 +
* [[OpenWRT: Build Firmware Mikrotik RB433]]
 +
* [[OpenWRT: Build Firmware Linksys WRT160NL]]
 +
* [[OpenWRT: Build Firmware Linksys WRT54GL]]
 +
 +
===APRX===
 +
 +
 +
* [[OpenWRT: Build Firmware Buffalo WZRHPG300NH2 untuk APRX]]
 +
 +
===IPv6===
 +
 +
* [[OpenWRT: IPv6]]
 +
* [[OpenWRT IPv6: Build Firmware Linksys WRT160NL]]
 +
* [[OpenWRT IPv6: Build Firmware Linksys WRT160NL Tanpa WebGUI]]
 +
* [[OpenWRT IPv6: Build Firmware Buffalo WZRHPG450H]]
 +
* [[OpenWRT IPv6: Build Firmware Buffalo WZRHPG300NH2]]
 +
* [[OpenWRT IPv6: Setup tunnel ke tunnelbroker]]
 +
* [[OpenWRT IPv6: Konfigurasi]]
 +
* [[OpenWRT IPv6: Konfigurasi WAN6 dengan radvd]]
 +
 +
===Flash Firmware===
 +
 +
* [[OpenWRT: Flash Linksys WRT54GL]]
 +
* [[OpenWRT: Flash Linksys WRT160NL]]
 +
* [[OpenWRT: Flash Buffalo WZRHP450H]] '''RECOMMENDED'''
 +
* [[OpenWRT: Flash Buffalo WZRHP300N]]
 +
* [[OpenWRT: Flash UBNT NanoStation2]] '''RECOMMENDED'''
 +
* [[OpenWRT: Flash UBNT NanoStation M2]] '''RECOMMENDED'''
 +
* [[OpenWRT: Flash UBNT NanoStation Loco M2]]
 +
* [[OpenWRT: Flash UBNT Bullet M2]] '''RECOMMENDED'''
 +
* [[OpenWRT: Flash Mikrotik RB433]] '''RECOMMENDED'''
 +
* [[OpenWRT: Flash Mikrotik RB450]]
 +
 +
===Misc===
 +
 +
* [[OpenWRT: Setup WiFi]]
 +
* [[OpenWRT: Setup PPTP VPN Server]]
 +
* [[OpenWRT: Setup OLSR di UBNT via CLI]] '''RECOMMENDED'''
 +
* [[OpenWRT: Mikrotik RB433]]
 +
* [[OpenWRT: Setup OLSR Sederhana]]
 +
* [[OLSR - di OpenWRT]]
 +
* [[OpenWRT: 3G modem]]
 +
* [[OpenWRT: Build Firmware dengan 3G Modem Support]]
 +
* [[OpenWRT: Setup Firewall]]
 +
* [[OpenWRT: Konfigurasi UBNT NanoStation2 tanpa WebGUI]]
 +
 +
===UBNT===
 +
 +
* [[UBNT]]
 +
* [[UBNT: Teknik Recovery]]
 +
* [[UBNT: Upload Firmware]]
 +
* [[UBNT: Rebuild Firmware]]
 +
* [[UBNT: firmware dengan OLSR]]
 +
* [[UBNT: openwrt]]
 +
* [[UBNT: olsr dengan openwrt]]
 +
* [[UBNT: olsr dengan kamikaze openwrt]]
 +
* [[UBNT: olsr dengan backfire openwrt]] '''RECOMMENDED'''
 +
* [[UBNT: UniFi]]
 +
* [[UBNT: UniFi Konfigurasi Awal]]
 +
* [[UBNT: UniFi Manajemen HotSpot]]
 +
* [[UBNT: OLSR Pembuatan Firmware]]
 +
* [[UBNT: OLSR Konfigurasi]]
 +
* [[OLSR - di UBNT]]
 +
* [[OLSR - di Ubuntu]]
 +
* [[OpenWRT]]
 +
* [[OLSR: NAT di UBNT dengan OLSR]]

Latest revision as of 18:00, 19 December 2013

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:


Prosedur

  • Lakukan pada komputer yang mempunya harddisk free 30Gbyte
  • Yang aman menggunakan Sistem Opersi Ubuntu 10.10, Ubuntu 12.04 entah kenapa sering gagal compile.
  • Lakukan sebagai non-root user
  • Lakukan semua perintah di <buildroot dir> misalnya ~/openwrt/trunk/
  • Sebaiknya lakukan dari fresh source code. Jadi buang terlebih dahulu <buildroot dir>, kemudian refresh dari sumber di Internet.
  • 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.
  • Lakukan instalasi OpenWrt

Persiapan

Lakukan

sudo su
apt-get update
apt-get install subversion gawk flex sharutils bison libz-dev patch fakeroot lzma git-core build-essential

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


Download Source Code

Yang akan membuat lama & frustasi adalah download source yang akan di compile dari nol. Terutama

80MB http://launchpad.net/gcc-linaro
60MB ftp://ftp.all.kernel.org/pub/linux/kernel/v3.x/

Tips

Kita dapat menentukan / menset chipset mana yang akan kita gunakan. Di target/linux/chipname/, ada makefile yang mengatakan kernel mana yang akan dibuat, contoh di Kamikaze tepatnya kamikaze/target/linux/atheros/Makefile.

LINUX_VERSION:=2.6.23.17

Ubah ini sesuai dengan subversion yang anda inginkan.

Build di multi-core CPU

Proses build dapat di percepat dengan menjalankan beberapa concurrent job process mengunakan option -j seperti

make -j 3

Gunakan standard formula <jumlah CPU + 1>. Jika cara ini menyebabkan error saat build, coba compile tanpa option -j.


Build di background

Jika anda ingin menggunakan sistem / mesin anda waktu anda build, kita dapat membuat proses build hanya menggunakan I/O dan kapasitas CPU yang ide, contoh untuk CPU dualcore:

ionice -c 3 nice -n 20 make -j 2

Build single Packages

Saat kita melakukan developing atau packaging software untuk OpenWrt, akan lebih memudahkan jika kita dapat membuat untuk package yang kita inginkan saja (misalnya untuk package cups):

make package/cups/compile V=99

Untuk package mc (midnight commander), yang kebetulan berada feed packages perintahnya akan seperti

make package/feeds/packages/mc/compile v=99

Melihat build errors

Jika build gagal, cara yang paling gampang untuk melihat error adalah melalui perintah

make V=99 2>&1 | tee build.log | grep -i error

Perintah di atas akan menyimpan copy full verbose dari output build (dengan stdout di pipe ke stderr) di /openwrt/trunk/build.log dan hanya memperlihatkan error saja ke screen

Contoh lain

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)'

Cara di atas menyimpan copy full verbose dari output build (dengan stdout di pipe ke stderr) di build.log dan akan mengeluarkan hanya warning dan error saat building menggunakan resource background di dual core CPU.

Notifikasi Beep

Tergantung pada CPU yang kita gunakan, proses build akan memakan waktu sebentar, atau lama. Jika kita menginginkan notifikasi suara, kita dapat menggunakan 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

Kadang kita ingin membersihkan lingkungan build. Contoh berikut akan sangat berguna,

Clean

Delete isi bin dan directory build_dir

make clean

Dirclean

make dirclean

Delete isi /bin dan /build_dir directory juga /staging_dir dan /toolchain (=cross-compile tool). 'Dirclean' adalah untuk memperoleh "Full clean".

atau dipaksa banget dengan

make FORCE=1 dirclean

Distclean

make distclean

Hancurkan semua yang pernah kita compile atau configure dan delete semua content feed dan package source yang pernah kita download.

PERHATIAN: Perintah ini akan menghapus build configuration (.config).

Referensi

Pranala Menarik

Build Firmware

APRX

IPv6

Flash Firmware

Misc

UBNT