In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "how to create an openwrt software package". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Method 1. Generate SDK
Make menuconfig select "Build the OpenWRT SDK", then Save, exit. Make again.
After make is completed, a zip file of SDK is generated in the bin/ramips/ directory:
OpenWrt-SDK-ramips-rt305x_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
2. Install SDK
Extract the OpenWrt-SDK-ramips-rt305x_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2 generated above to another directory
3. Create a helloworld project
In fact, this can be any program, library, etc. that we want to join. Take helloword as an example.
Create a helloword project under any path. For example, it is still in the ~ / Workspace/OpeWRT directory.
$cd ~ / Workspace/OpenWRT$ mkdir helloword$ cd helloword$ touch helloword.c Makefile
The helloword directory is created under the ~ / Workspace/OpenWRT/ directory, and the helloword.c and Makefile files are generated.
The following is the content of helloworld.c:
# include int main () {printf ("This is my hello word!\ n"); return 0;}
The content of Makefile:
Helloworld: helloworld.o $(CC) $(LDFLAGS) helloworld.o-o helloworldhelloworld.o: helloworld.c $(CC) $(CFLAGS)-c helloworld.cclean: rm * .o helloworld
Make yourself to make sure there is no problem with the program, and be sure to pay attention to the tab space.
4. Create a helloworld package
Go to OpenWrt/Packages/ and create a helloworld directory under that directory, and enter that directory.
$cd ~ / Workspace/OpenWrt/OpenWrt-SDK/package$ mkdir helloworld$ cd helloworld
Copy the program we wrote in step 3 to this directory and rename it src. Create a new Makefile file.
$cp-r.. / helloworld src$ touch Makefile
Throughout the process, the package directory structure is as follows:
Package |-- helloworld | |-- Makefile | `--src | |-- helloworld.c |`-- Makefile`-- Makefile
The Makefile file is as follows:
Include $(TOPDIR) / rules.mkPKG_NAME:=helloworldPKG_RELEASE:=1PKG_BUILD_DIR:=$ (BUILD_DIR) / $(PKG_NAME) include $(INCLUDE_DIR) / package.mkdefine Package/helloworld SECTION:=utils CATEGORY:=Utilities TITLE:=Hello worldviews! DEPENDS:=+libwebsockets + libsqlite3 + libjson-cendefdefine Package/helloworld/description It's my first package demo.endefdefine Build/Prepare mkdir-p $(PKG_BUILD_DIR) $(CP). / src/* $(PKG_BUILD_DIR) / endefdefine Package/helloworld/install $(INSTALL_DIR) $(1) / usr/sbin $(INSTALL_BIN) $(PKG_BUILD_DIR) / $(PKG_NAME) $(1) / usr/sbinendef$ (eval $(call BuildPackage,helloworld))
Make-j1 VIPs succeeded. A helloworld_1_ramips_24kec.ipk was generated.
5. Test helloworld
Through WinSCP, you can access / tmp in the openwrt root directory on ipk.
Cd / tmpopkg install helloworld_1_ramips_24kec.ipk
Use the which command to view the path to the helloworld installation:
Which helloworld
Under / bin/ path
Cd / binhelloworld method II. Create a helloworld project
Copy the method 1 create helloworld folder to package under the openwrt root directory.
2. Select helloworld project make menuconfig
Utilities-- "helloworld check and save exit
Make-j3 VIPs
To compile the module separately:
Make package/helloworld/compilemake package/helloworld/install3, experimental helloworldcd / binhelloworld4, follow-up development
Replace the old helloworld file with the new hellworld file
Recompile
Make package/helloworld/compile
Find the regenerated helloworld file under. / build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/helloworld/ipkg-ramips_24kec/helloworld/bin in the openwrt directory and replace the helloworld under router / bin.
That's all for "how to create an openwrt package". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.