【正文】
t even use ipkg to remove anything.Can we switch the filesystem to be entirely jffs2?Yes, it39。t need to align the data, allowing it to pack the files tighter for 2030% savings over a jffs2 filesystem.Our job when writing the firmware is to put as much mon functionality on squashfs while not wasting space with unwanted features. Additional features can always be installed onto jffs2 by the user. The use of mini_fo means that the filesystem is presented as one large writable filesystem to the user with no visible boundary between squashfs and jffs2 files are simply copied to jffs2 when they39。s upgrade utilities and the remaining data the trx gets written to the flash. When upgrading from within openwrt remember to use the trx file.)So what exactly is the firmware?The boot loader really has no concept of filesystems, it pretty much assumes that the start of the trx data section is executable code. So, at the very start of our firmware is the kernel. But just putting a kernel directly onto flash is quite boring and consumes a lot of space, so we press the kernel with a heavy pression known as LZMA. Now the start of firmware is code for an LZMA depress:Code:[lzma depress][lzma preszsed kernel]Now, the boot loader boots into an LZMA program which depresses the kernel into memory and executes it. It adds a second to the bootup time, but it saves a large chunk of flash space. (And if that wasn39。s no actual partitions, just hard coded locations)The job of the boot loader is to initialize the memory and other hardware and then begin booting the firmware. In most cases there39。 provided by a broad 47xx or 5352) 6 port vlan managed switch (adm6996l, or more monly the broad roboswitch) wifi (broad 43xx based)Chances are that almost all of that functionality will e from one or two Broad chips. The ram and flash are the exception.Depending on the device you could have as little as 2/8 (ram/flash) or as much as 8/32, but by far the most mon bination is 4/16。這兩種文件沒有特別的差異。從5~15行,定義了一組非常有用的變量:l PKG_NAME:軟件包的名字l PKG_VERSION:應(yīng)該下載的軟件包的版本號(hào)l PKG_RELEASE:發(fā)行號(hào)l PKG_MD5SUM:md5較驗(yàn)值l PKG_SOURCE_URL:下載的地址完全路徑,可以使用HTTP或FTP。(3) 修改package/為了使你的軟件包能加入到配置工具中,你還需要修改package/:ment Networkingsource package/foo/(4) 修改package/Makefile要將你的軟件包foo添加到編譯的過程中,需要對(duì)package/Makefile進(jìn)行修改:package$(BR2_PACKAGE_FOO) += foo除了默認(rèn)的依賴關(guān)系外,若你的軟件包還依賴于其它軟件,則添加:foopile: barpile(5) ipkg控制文件此外還需要?jiǎng)?chuàng)建一個(gè)控制文件用以包含你的軟件包的信息,這些信息將被ipkg工具使用。 在其它地方使用uClibc工具鏈默認(rèn)情況下交叉編譯工具鏈?zhǔn)巧稍谀夸泂taging_dir_ARCH/目錄中。為了正確的配置該staging目錄,該目錄會(huì)首先被刪除,然后再創(chuàng)建里面的子目錄和文件、符號(hào)鏈接文件等。該目錄是壓縮包所下載的目錄,可以通過將其保存起來以避免再次下載。每一個(gè)軟件都有一個(gè)Makefile,一般被命名為“Makefile”。 定制uClibc配置就像BusyBox一樣,uClibc也提供了許多的配置選項(xiàng)。該方法可以目標(biāo)文件系統(tǒng)做任何事情,不過如果你決定重構(gòu)我的工具鏈、工具或包,則這些修改會(huì)丟掉。 Jffs2包含一個(gè)可寫的根文件系統(tǒng),它可以擴(kuò)展你的flash映像的大小。 獲取OpenWrt Buildroot通過svn可以獲取相應(yīng)的OpenWrt:對(duì)于各種OpenWrt開發(fā),可以使用如下命令獲取最新的版本:$svn co 如果你只需要?jiǎng)?chuàng)建自定義的固件映像及包,我們推薦你使用穩(wěn)定版本:$ svn co 使用OpenWrt BuildrootOpenWrt的配置界面和Linux內(nèi)核配置()及busybox()的配置界面類似。這樣的編譯工具鏈系統(tǒng)稱為“host pilation toolchain”。因此在這方面應(yīng)該進(jìn)行減負(fù)!認(rèn)證程序不能在路由器上永遠(yuǎn)保存,一掉電或重啟則認(rèn)證程序就丟掉了。然后再次登錄到路由器進(jìn)行認(rèn)證,此時(shí)可以得到正確的反饋信息。說來話長,Broad 的交換機(jī)驅(qū)動(dòng)里面有一個(gè) BUG ,導(dǎo)致 網(wǎng)絡(luò)包無法發(fā)送。這個(gè)問題似乎并沒有得到解決!因?yàn)槲以趯?shí)驗(yàn)室里可以認(rèn)證成功,而回到寢室里就又出現(xiàn)同樣的情況。該認(rèn)證程序的認(rèn)證邏輯非常清晰,主要認(rèn)證機(jī)制全部分析清楚透徹。2 編譯運(yùn)行新程序 通過登錄到路由器查看內(nèi)核的版本號(hào)發(fā)現(xiàn):cat /proc/version。對(duì)于開發(fā)人員來說,OpenWrt是一種編譯程序的框架,其不需要有完整的固件。 and VxWorks174。但是目前只能進(jìn)行靜態(tài)編譯,即將所有的庫文件鏈接成一個(gè)可執(zhí)行文件,而不能使用動(dòng)態(tài)鏈接!原因可能是因?yàn)槟繕?biāo)機(jī)器上的運(yùn)行的系統(tǒng)中所包含的動(dòng)態(tài)庫與交叉編譯環(huán)境中的動(dòng)態(tài)庫版本不同,應(yīng)該考慮將版本換成同樣的動(dòng)態(tài)庫后,再次進(jìn)行編譯!此外為了方便調(diào)試,可以讓目標(biāo)機(jī)器掛載編譯環(huán)境中的samba服務(wù)提供的共享文件,從而方便目標(biāo)機(jī)器與交叉編譯機(jī)器之間共享文件!在目標(biāo)機(jī)器上,, 目標(biāo)機(jī)器類型是:mipsel架構(gòu)(LIL_ENDIAN)假設(shè)交叉編譯環(huán)境安裝在/opt/openwrt/目錄下CC=/opt/openwrt/bin/mipsellinuxgccCFLAGS=I /opt/openwrt/includeLDFLAGS=L /opt/openwrt/libHost=mipsellinuxprefix=/opt/openwrt OpenWrtOpenWrt是用于嵌入式設(shè)備的Linux發(fā)行版。通過telnet登錄到路由器后,就獲得了一個(gè)shell,通過該shell就可以像使用普通linux系統(tǒng)一樣操作該路由器了。其中openwrt2目錄中包含的就是對(duì)應(yīng)交叉編譯工具鏈(編譯工具、標(biāo)準(zhǔn)庫等)。 運(yùn)行測(cè)試l 問題一:發(fā)送了認(rèn)證主播包,但是無任何響應(yīng)。我手上用的是 Linksys WRT54GS 手上的另外兩個(gè) Buffalo WHRG125 和 Buffalo WHRHPG54BCM5325 獨(dú)立交換芯片或者是像 BCM5354 這樣集成交換芯片的,都不行。若某個(gè)文件的其它人讀權(quán)限沒有打開,則顯然通過web是訪問不了的。其一般包括如下幾個(gè)部分:l 編譯器,如gccl 二進(jìn)制工具,如匯編器、鏈接器l C標(biāo)準(zhǔn)庫,如GNU Libc, uClibc, dietlibc安裝在你自己的開發(fā)環(huán)境中的系統(tǒng),本身已經(jīng)帶了一組編譯工具鏈,可以編譯生成能在你自己的機(jī)器架構(gòu)上運(yùn)行的二進(jìn)制文件。比如,如果你的主機(jī)系統(tǒng)使用的是X86,而你的目標(biāo)系統(tǒng)是MIPS,則通常的運(yùn)行在你主機(jī)上的X86編譯工具鏈編譯生成的代碼是用于X86,而運(yùn)行于X86的交叉編譯工具鏈則生成用MIPS的代碼。生成的所有目標(biāo)文件都可以在bin/子目錄中找到。 定制目標(biāo)文件系統(tǒng)當(dāng)前有兩種方式可以定制最終的目標(biāo)文件系統(tǒng)::直接定制目標(biāo)文件系統(tǒng),然后重編譯映像。 定制Busybox配置Busybox是可定制的,你可以根據(jù)自己的需要對(duì)其進(jìn)行定制。(4) 重新運(yùn)行編譯當(dāng)然,你也可以直接修改toolchain/uClibc/,而不需要運(yùn)行配置助理。支持兩種文件系統(tǒng):jffs2和squashfs.在每一個(gè)目錄中,至少包含兩個(gè)文件:l Makefile:下載、配置、編譯及安裝軟件的Makefiles.l :配置工具描述文件的一部分。(4) 配置staging目錄(默認(rèn)為staging_dir_ARCH/)。該工具位于staging_dir_ARCH/目錄。該文件將包含對(duì)foo軟件的配置選項(xiàng),而這些選項(xiàng)將會(huì)顯示在配置工具中。 \ 23 $(TARGET_CONFIGURE_OPTS) \ 24 CFLAGS=$(TARGET_CFLAGS) \ 25 ./configure \ 26 target=$(GNU_TARGET_NAME) \ 27 host=$(GNU_TARGET_NAME) \ 28 build=$(GNU_HOST_NAME) \ 29 prefix=/usr \ 30 sysconfdir=/etc \ 31 withbar=$(STAGING_DIR)/usr \ 32 )。(4) 指定ipkg控制文件創(chuàng)建target/linux/control/:Package: kmodusbkbdPriority: optionalSection: sysMaintainer: Markus Becker mabSource: buildroot internalDescription: Kernel Support for USB Keyboards(5) 編譯內(nèi)核模塊使用如下命令配置打開模塊支持:$ make menuconfig在頂層目錄找到并打開其配置選項(xiàng),之后使用如下命令編譯:$ make dirclean amp。若想做的話,參考:(2f)Installing(2f) 通過OpenWrt命令行安裝在OpenWrt環(huán)境下,可以使用如下命令: mtd –r write linux若RAM空間較小,則可以使用如下命令(不推薦): wget ://host/ O | mtd –e linux –r write – linux 恢復(fù)到原來的映像 保存原來的映像 使用mtd工具使用如下命令: cd /tmp下載原始映像到/tmp wget ://host/更換映像: td –e linux –r write linux,則僅需要去掉其頭即可: dd bs=32 skip=1 if= of= 使用ipk工具 本地host的軟件鏡像目錄~/whiterussian/bin/packages安裝apache2,在/var/中建立一個(gè)指向~/whiterussian/bin目錄的鏈拉whiterussian注意修改var/的訪問權(quán)限,特別是要打開發(fā)“其他人”的可讀權(quán)限。 think of it like the BIOS in your puter. (note in wrt54g hardware, it was actua