自定义oleg版固件

以 oleg wl500g-1.9.2.7-7g 版本 为例

所需文件

  1. GPL源码 GPL_1927.zip (实际上是tar.gz后缀)
  2. oleg源码 wl500g-1.9.2.7-7g.tar.bz2
  3. 修改过的toolchain hndtools-mipsel-uclibc-3.2.3-full.tar.bz2

编译环境

linux平台

因为跨平台编译, 所以需要一个PC上的linux环境, 我用的ubuntu 8.10

支持软件

以下软件需要通过 apt-get install <app_name>

  • 编译相关
libc6-dev
c标准库的头文件等
g++
cpp 编译器
zlib1g-dev
for zlib.h in LZMA& squashfs
  • 工具
patch
用来打补丁
  • 这几个忘了用在哪里的了
flex
语法处理,
gawk
文本处理

编译过程

准备文件

  • 解压GPL源码, 生成 /opt/broadcom 目录

tar -zxf GPL_1927.zip -C /opt

/opt/broadcom/src/
源码
/opt/broadcom/src/linux/linux/
kernel
/opt/broadcom/src/router/
路由器源码目录
  • toolchain 在 /opt/broadcom 目录, 移到外面来

mv /opt/broadcom/toolchain/* /opt/brcm/

  • 修改toolchain

tar -zxf hndtools-mipsel-uclibc-3.2.3-full.tar.bz2 -C /opt/brcm/
rm -rf /opt/brcm/hndtools-mipsel-uclibc
ln -s /opt/brcm/hndtools-mipsel-uclibc /opt/brcm/hndtools-mipsel-uclibc-3.2.3-full

  • 设置PATH, 加入toolchain 和 tool 路径

export PATH=/opt/brcm/hndtools-mipsel-uclibc:/opt/brcm/hndtools-mipsel-linux:$PATH
export PATH=/opt/broadcom/tools:$PATH

  • 解压oleg代码, 生成 /opt/broadcom/src/wl500g-1.9.2.7-7g 目录

tar -jxf wl500g-1.9.2.7-7g.tar.bz2 -C /opt/broadcom/src

修改 kernel 配置

配置位于 /opt/broadcom/src/wl500g-1.9.2.7-7g/kernel.config
该配置最终会覆盖 /opt/broadcom/src/linux/linux/.config, 具体过程:

/opt/broadcom/src/wl500g-1.9.2.7-7g/Makefile
[make kernel]
125 kernel: lzma et kernel-mrproper
142 cp kernel.config $(KERNEL_DIR)/arch/mips/defconfig-bcm947xx

/opt/broadcom/src/gateway/Makefile
[make]
335 $(LINUXDIR)/.config:
336 cp $(LINUXDIR)/arch/mips/defconfig-bcm947xx $@

应用oleg补丁

cd /opt/broadcom/src/wl500g-1.9.2.7-7g

给kernel 打补丁

make kernel

给其他文件打补丁

make

完成之后会生成 /opt/broadcom/src/gateway目录

自定义选项

vim /opt/broadcom/src/gateway/Makefile

可修改RELEASE变量, 该变量值会写入路由器上的 /.version 中

vim /opt/broadcom/src/linux/linux/Makefile

修改kernel的配置(也可在打补丁之前? 修改kernel.config)

编译

cd /opt/broadcom/src/gateway

  • 编译内核及modules

make

生成vmlinux内核文件, 一堆*.o形式的modules

  • 生成trx

make install

这一步会使用压缩工具将vmlinux以及路由器的文件一同一起压缩至trx.

linux/linux/Makefile

make menuconfig

通过界面配置kernel

大部分选项有3种方式可选:

n
不编译
y
编译进内核
m
编译成modules

menuconfig 完成会生成 .config 文件, 该文件会在makefile中include

make modules

<mod>.c 会首先编译成 <mod>.o, 然后通过objcopy去除commet等不用的段, 转换成最终的<mod>.o

make modules_install

这一步会将 <mod>.o 拷贝到 /lib/modules/…
之后即可通过 insmod <mod> 启用该 module
如果自己拷贝到其他地方, 则insmod时需要指定完整的路径, 而无法只用module名字

codepage (Native Language Support : NLS)

codepage的在menuconfig中位于 FileSystem-> Native Language Support
其源代码位置是 kernel/fs/nls/nls_*.c

常用codepage

936 简体中文 (gb2312 简体中文国标)
950 繁体中文 (big5 繁体中文 )

codepage & iocharset

具体含义以及区别可参考 mount

codepage设定值不加cp前缀, iocharset要加cp前缀
例如mount时

mount -t vfat -o codepage=936,iocharset=cp936 /dev/discs/sda1 /mnt

相关话题

APT RyanLeeRyanLee rev. 4 10 Dec 2007 14:42
ARM RyanLeeRyanLee rev. 21 10 Apr 2008 15:19
ASUS WL-500g Premium (WL500gP) RyanLeeRyanLee rev. 21 04 Jan 2008 15:49
C / C++ / VC 点滴 RyanLeeRyanLee rev. 4 14 Dec 2007 12:32
ClearCase RyanLeeRyanLee rev. 4 29 Nov 2007 11:45
Contact RyanLeeRyanLee rev. 5 18 Mar 2007 13:03
crack novas RyanLeeRyanLee rev. 7 14 Dec 2007 13:01
ctags RyanLeeRyanLee rev. 3 10 Dec 2007 15:01
CVS 使用经验小结 RyanLeeRyanLee rev. 2 14 Dec 2007 15:30
debussy RyanLeeRyanLee rev. 11 17 Dec 2007 09:08
denali RyanLeeRyanLee rev. 5 28 Nov 2007 14:43
EDA RyanLeeRyanLee rev. 1 10 Aug 2007 08:18
Excel RyanLeeRyanLee rev. 3 14 Dec 2007 13:54
file RyanLeeRyanLee rev. 2 21 Mar 2007 13:14
Firefox RyanLeeRyanLee rev. 1 20 Dec 2007 15:31
Forum Categories RyanLeeRyanLee rev. 0 16 Mar 2007 13:36
Forum Category RyanLeeRyanLee rev. 0 16 Mar 2007 13:36
Forum Thread RyanLeeRyanLee rev. 0 16 Mar 2007 13:36
page 1 of 512345next »

子页面

引用页

评论


rating: 0+x

Add a New Comment
or Sign in as Wikidot user
(will not be published)
- +
Page tags: kernel linux oleg wl500gp
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.