当前位置:首页 » 编程软件 » openwrt编译需要网络吗

openwrt编译需要网络吗

发布时间: 2025-01-28 03:49:16

① openwrt sbin/wifi 是哪些源文件编译而来的

1. make menuconfig
这次openwrt升级后, 编译完刷上固件,openwrt会自动进入failsafe模式。怎么编译都不行。 后来发现, 新的固件里面选择了 Kernel Moles\Other moles\kmod-button-hotplug 模组。这个模组在启动的时候,触发了"f"或者“enter”按键,所以在启动的过程中就自动进入了failsafe模式。取消选择后,一切正常。
2. 不要整个LUCI, 只是要Luci rpc模块的话, Luci\Collection\Luci不要选择。 则整个web界面都不会被安装。只有rpc的功能会存在。
2. Openwrt默认不开启wifi,要开启的话, 修改这个文件: openwrt/trunk/package/kernel/mac80211/files/lib/wifi/mac80211.sh. 滚到文件最后, 注释掉
# REMOVE THIS LINE TO ENABLE WIFI:
#option disabled 1

3. openwrt默认开机启动ssh的方法
http://www.2cto.com/os/201304/204073.html
2.1 Openwrt下的路径:package/network/services/dropbear/files/dropbear.config
[openwrt@root files]$ vim dropbear.config
1config dropbear
2 option PasswordAuth 'on'
3 option RootPasswordAuth 'on'
4 option Port '22'
5 option Interface 'lan'
6# option BannerFile '/etc/banner'

openwrt/trunk/package/base-files/files/etc/shadow
root:$1$uml/DyCk$QHYqbMVYwxtE4Tk.SVifM.:15838:0:99999:7:::
密码:123456
4. Luci 的文件拷贝到
rpc.lua 拷贝到 openwrt/trunk/feeds/luci/moles/rpc/luasrc/controller
openwrt/trunk/feeds/luci/libs/web/luasrc

② 如何编译OpenWrt

准备工作
在开始编译Openwrt之前需要您做些准备工作;与其他编译过程一样,类似的编译工具和编译环境是必不可少的:
一个构建OpenWrt映像的系统平台,简单说就是准备一个操作系统(比如Ubuntu、Debian等);
确保安装了所需的依赖关系库, (在debian系统中就是安装各种需要的软件包)
OpenWrt源代码副本
首先, 开机登陆到支持编译Openwrt的操作系统(废话了)。实体机或者虚拟机(Vmware 或者 Qemu)里的操作系统都行,这里推荐使用linux系统。 bsd和mac osx系统也可以编,但不推荐,且未验证是否可编译成功。下文假定您使用的是Debian操作系统,使用 apt-get 来管理包. 替代的选择是 Ubuntu (分支 Kubuntu, Xubuntu 等即可)。
第二步, 就是安装所需要的各种软件包, 包括编译器,解压工具,特定的库等. 这些工作可以简单的通过键入以下命令 (通常需要root 或者是 sudo 权限),以root权限安装下列软件包(可能并不完整,会有提示,提示缺少即装就可以了):
32位(x86)请执行下列命令:
# apt-get install build-essential asciidoc binutils bzip2 gawk gettext \
git libncurses5-dev libz-dev patch unzip zlib1g-dev

64位(x86_64)请执行下列命令(多装了哪些库或软件包呢?请您仔细看一看哦):
# apt-get install build-essential asciidoc binutils bzip2 gawk gettext \
git libncurses5-dev libz-dev patch unzip zlib1g-dev ia32-libs \
lib32gcc1 libc6-dev-i386

参考 本列表中 所列的编译环境所需要软件包或库。
某些依赖的为库或软件包也许操作系统中已经安装过,此时apt-get会作出提示(提示您忽略或重新安装的),别紧张,放轻松些,编译Openwrt不会像编译DD-WRT那样难的(至少本人是体会到了编译DD-WRT的难)。
最后下载一份完整的 Openwrt 源码到编译环境中。关于Openwrt的源代码下载,途径有二,一是通过 svn ,一是通过 git,建议使用 svn ,因为Openwrt主要以 svn 来维护Openwrt系统的版本。另外,请注意Openwrt中不同的分支版本,一个是用得较多的开发快照,俗称 trunk,二是稳定版,俗称 backfire。

③ 如何在64位ubuntu系统上编译openwrt

首先, 安装完依赖(并不是所有的依赖都被脚本检查), 请参考 OpenWrt Buildroot 然后, 请使用较新的linux发行版, 因为openwrt比较新, 所以相应的host编译主机也要比较新才行. 最后, 在网络通畅情况下编译, 再运行一次make V=s试试

④ 小白求教,关于openwrt的Makefile

1、搭建开发环境
首先,在执行make menuconfig后,

其中,图中红框部分是我定制路由器的系统版本,大家可以根据不同的路由器进行不同的选择;绿框部分表示我们需要编译一个SDK开发环境(默认情况下,此项未勾选)。
编译过程中需要通过官网下载很多相关的软件包,所以必须保证能够顺利连上外网。由于下载速度的限制,编译过程大概需要数小时。编译结束后,所有的产品都会放在编译根目录下的bin/yourtarget/. 例如:我所编译的产物都放在./bin/brcm47xx/下,其中文件主要有几类:
(1).bin/.trx 文件: 这些都是在我们所选的target-system的类别之下,针对不同路由器型号、版本编译的路由器固件。这些不同路由器的型号和版本是openwrt预先设置好的,我们不需要更改。至于.bin和.trx的区别,一种说法是,第一次刷路由器的时候,需要用.bin文件,如果需要再升级,则不能再使用.bin文件,而需要用.trx文件。原因是,.bin是将路由器的相关配置信息和.trx封装在一起而生成的封包,也就是说是包含路由器版本信息的.trx。在第一次刷固件的时候,我们需要提供这样的信息,而在后续升级时,则不再需要,用.trx文件即可。
(2)packages文件夹: 里面包含了我们在配置文件里设定的所有编译好的软件包。默认情况下,会有默认选择的软件包。
(3)OpenWrt-SDK.**.tar.bz2: 这个也就是我们定制编译好的OpenWRT SDK环境。我们将用这个来进行OpenWrt软件包的开发。例如,我所编译好的SDK环境包为:/bin/brcm47xx/OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1.tar.bz2
可以从名称上看出,target system是brcm47xx,host system是Linux-x86_64,使用的编译工具以及库是4.3.3+cs_uClibc-0.9.30.1。
(4)md5sums 文件: 这个文件记录了所有我们编译好的文件的MD5值,来保证文件的完整性。因为文件的不完整,很容易将路由器变成“砖头”。
需要主要的是,编译完成后,一定要将编译好的bin目录进行备份(如果里面东西对你很重要的话),因为在下次编译之前,执行make clean 会将bin目录下的所有文件给清除掉!!
2、 更改原有packages
在编译根目录下会有一个dl的目录,这个目录其实是“download”的简写,在编译前期,需要从网络下载的数据包都会放在这个目录下,这些软件包的一个特点就是,会自动安装在所编译的固件中,也就是我们make menuconfig的时候,为固件配置的一些软件包。如果我们需要更改这些源码包,只需要将更改好的源码包打包成相同的名字放在这个目录下,然后开始编译即可。编译时,会将软件包解压到build_dir目录下。
当然,你也可以自己在dl里面创建自己的软件包,然后更改相关的配置文件,让openwrt可以识别这个文件包。
由于我的项目更改的内容是底层的,需要跟固件一起安装。所以,我使用的方法就是直接更改dl目录下软件包,然后重新进行固件编译。感觉类似于Linux的内核编译。反复编过十多次,没有任何问题。
3、 新建自己的packages
对于自己新建的package,而这个package又不需要随固件一起安装,换句话说,就是可以当做一个可选软件包的话。我们可以利用我们的SDK环境来单独编译,编译后会生成一个ipk的文件包。然后利用 opkg install xxx.ipk 来安装这个软件。
下面具体说下,如何编译一个helloword的软件包。
(1)首先,编写helloworld程序
编写helloworld.c
/****************
* Helloworld.c
* The most simplistic C program ever written.
* An epileptic monkey on crack could write this code.
*****************/
#include <stdio.h>
#include <unistd.h>
int main(void)
{
printf("Hell! O' world, why won't my code compile?\n\n");
return 0;
}
编写Makefile文件
# build helloworld executable when user executes "make"
helloworld: helloworld.o
$(CC) $(LDFLAGS) helloworld.o -o helloworld
helloworld.o: helloworld.c
$(CC) $(CFLAGS) -c helloworld.c
# remove object files and executable when user executes "make clean"
clean:
rm *.o helloworld
在这两个文件的目录下,执行make 应该可以生成helloworld的可执行文件。执行helloworld后,能够打印出“Hell! O' world, why won't my code compile?”。 这一步,主要保证我们的源程序是可以正常编译的。下面我们将其移植到OpenWRT上。
(2)将OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1.tar.bz2解压
tar –xvf OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1.tar.bz2
(3)进入SDK
cd OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1
可以看到里面的目录结构跟我们之前source的目录结构基本相同,所需要编译的软件包,需要放置在package目录下
(4)在package目录下创建helloworld目录
cd package
mkdir helloworld
cd helloworld
(5)创建src目录,拷贝 helloworld文件
mkdir src
cp /home/wrt/test/helloworld.c src
cp /home/wrt/test/Makefile src
(6)在helloworld目录下创建Makefile文件
这个Makefile文件是给OpenWRT读的,而之前写的那个Makefile文件是针对helloworld给编译其读的。两个Makefile不在同一层目录下。
touch Makefile
vim Makefile
Makefile文件模板内容如下:
##############################################
# OpenWrt Makefile for helloworld program
#
#
# Most of the variables used here are defined in
# the include directives below. We just need to
# specify a basic description of the package,
# where to build our program, where to find
# the source files, and where to install the
# compiled program on the router.
#
# Be very careful of spacing in this file.
# Indents should be tabs, not spaces, and
# there should be no trailing whitespace in
# lines that are not commented.
#
##############################################
include $(TOPDIR)/rules.mk
# Name and release number of this package
PKG_NAME:=helloworld
PKG_RELEASE:=1
# This specifies the directory where we're going to build the program.
# The root build directory, $(BUILD_DIR), is by default the build_mipsel
# directory in your OpenWrt SDK directory
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
# Specify package information for this program.
# The variables defined here should be self explanatory.
# If you are running Kamikaze, delete the DESCRIPTION
# variable below and uncomment the Kamikaze define
# directive for the description below
define Package/helloworld
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Helloworld -- prints a snarky message
endef
# Uncomment portion below for Kamikaze and delete DESCRIPTION variable above
define Package/helloworld/description
If you can't figure out what this program does, you're probably
brain-dead and need immediate medical attention.
endef
# Specify what needs to be done to prepare for building the package.
# In our case, we need to the source files to the build directory.
# This is NOT the default. The default uses the PKG_SOURCE_URL and the
# PKG_SOURCE which is not defined here to download the source from the web.
# In order to just build a simple program that we have just written, it is
# much easier to do it this way.
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./src/* $(PKG_BUILD_DIR)/
endef
# We do not need to define Build/Configure or Build/Compile directives
# The defaults are appropriate for compiling a simple program such as this one
# Specify where and how to install the program. Since we only have one file,
# the helloworld executable, install it by ing it to the /bin directory on
# the router. The $(1) variable represents the root directory on the router running
# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install
# directory if it does not already exist. Likewise $(INSTALL_BIN) contains the
# command to the binary file from its current location (in our case the build
# directory) to the install directory.
define Package/helloworld/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/
endef
# This line executes the necessary commands to compile our program.
# The above define directives specify all the information needed, but this
# line calls BuildPackage which in turn actually uses this information to
# build a package.
$(eval $(call BuildPackage,helloworld))
(7)返回到SDK的根目录
执行make进行编译
编译过程会在build_dir目录下完成
编译结果会放在 bin/[yourtarget]/package目录下helloworld_1_bcm47xx.ipk
(8)上传helloworld_1_bcm47xx.ipk
使用sftp软件上传helloworld_1_bcm47xx.ipk至路由器
执行 opkg install helloworld_1_bcm47xx.ipk
输入hello然后按Tab键,发现openwrt中已经有helloworld可执行命令。
执行 helloworld 查看程序的效果。

⑤ openwrt编译流程

编译OpenWRT源码至Ubuntu下,需先进入OpenWRT根目录。通常,简单操作为执行命令make V=99。若系统为多核处理器,为加速编译过程,可添加-j选项,如make –j3 V=99。在编译过程中,系统将自动下载所需软件包,请确保网络畅通。若在编译时遇到下载失败,可先执行make download指令,提前下载所需包,以避免后续错误。

初次编译耗时较长,且需下载大量源码包,建议使用较好的VPN,以加速过程。完成编译后,会在源码目录中生成一个名为bin的文件夹,其中包含两个文件:openwrt-ramips-rt305x-wr703n-squashfs-factory.bin 和 openwrt-ramips-rt305x-wr703n-squashfs-sysupgrade.bin。根据路由器的原始固件或已安装的OpenWRT版本,选择相应的固件进行刷写。

在编译过程中,掌握一些技巧有助于提升效率。例如,执行make clean可以清理基本编译文件,make dirclean则会深度清理文件,相当于执行make clean后再清除交叉编译工具链目录。使用make distclean则会清除所有相关东西,包括下载的软件包、配置文件及feed内容等。在个人开发中,常遇menuconfig无法更新问题,可通过删除tmp缓存目录解决。预先下载软件包,再执行编译的make download V=99方法同样有效。最后,删除.config文件以清空所有配置。

热点内容
如何在云主机上搭建web服务器 发布:2025-03-06 21:09:05 浏览:587
电脑改为服务器有什么用 发布:2025-03-06 21:00:38 浏览:269
网站在文件夹 发布:2025-03-06 20:51:46 浏览:116
阿玛尼行李箱密码锁如何换密码 发布:2025-03-06 20:46:02 浏览:104
xp共享文件夹win7无法访问 发布:2025-03-06 20:35:40 浏览:589
oracle存储过程excel 发布:2025-03-06 20:35:10 浏览:889
lay源码 发布:2025-03-06 20:25:29 浏览:751
专家系统原理与编程 发布:2025-03-06 20:21:05 浏览:641
脚本召唤暴龙 发布:2025-03-06 20:19:29 浏览:81
访问学者邀请函英文 发布:2025-03-06 20:18:06 浏览:381