超过460,000+ 应用技术资源下载


  • 1星
  • 日期: 2015-06-08
  • 大小: 167.72KB
  • 所需积分:0分
  • 下载次数:0
  • favicon收藏
  • rep举报
  • 分享
  • free评论
标签: flexroad

tell you how to start development in openwrt

Componentality Oy Ratakatu 47, 53100 Lappeenranta, Finland Tel.: +358 046 5662016 Email: Web: Step By Step Guide for Starting "Hello, World!" on OpenWRT Installation. All actions of this step should be performed by a non-root user. Directories with spaces in their full path are not allowed. 1. Install SVN by running the following commands in the terminal. Respond positively when asked to confirm. sudo apt-get update sudo apt-get install subversion build-essential 2. Create openwrt folder in the home folder. mkdir ~/openwrt 3. Open it cd ~/openwrt 4. Download OpenWRT Attitude Adjustment, by running the following command: svn co svn:// 5. Open attitude_adjustment folder cd attitude_adjustment 6. Download and install all available feeds ./scripts/feeds update -a ./scripts/feeds install –a 7. Obtain a list of missing packages for successful build, using the following command: make menuconfig If the installation of OpenWRT is not interfered with anything, as evidenced by the absence of errors, proceed to step 8. Otherwise you will be notified of the missing packages in the following way: Build dependency: Please install ncurses. (Missing or ncurses.h) Under Ubuntu 12.10 operating system build required the following packages: ncurses, zlib, GNU awk, and git. Commands that install the missing packages: sudo apt-get install libncurses5-dev sudo apt-get install zlib1g-dev Componentality Oy Ratakatu 47, 53100 Lappeenranta, Finland Tel.: +358 046 5662016 Email: Web: sudo apt-get install gawk sudo apt-get install git-core During installation you’ll have to enter root-user’s password and agree if asked to confirm installation. If the list of missing packages differs from the above list, you can use the following command for finding the necessary package apt-cache search "" enter the name of the missing component obtained through make menuconfig in brackets. You might also find helpful the table of the most frequent issues that is available at the following address: («Table of known prerequisites and their corresponding packages»). Select the column with your operating system and the line with the missing package and find what you need to install at the crossing. When all necessary components are installed you’ll see a configuration menu (a grey window on a blue background) 8. The settings should be the following: • Target system - Atheros AR7xxx/AR9xxx • Subtarget - Devices with NAND flash (mostly Mikrotik) • Target profile - Atheros WiFi (ath5k) 9. Save settings and exit 10. In attitude_adjustment folder start the build, using make command Attention! Build takes 2-6 hours. II. Package assembly 1. Create a folder for source codes. Locate it in the OpenWRT root cd ../ mkdir hello cd hello As a result you should get a hello folder in the openwrt folder, next to attitude_adjustment folder. In case of an author, it is /home/user/openwrt/hello 2. Create two files hello.c and Makefile in this folder. The first file will contain the source code on C and the second one – build rules. touch hello.c touch Makefile # file name with a capital letter Both files contain: hello.c #include void main() { printf("Hello, World!\n"); } Componentality Oy Ratakatu 47, 53100 Lappeenranta, Finland Tel.: +358 046 5662016 Email: Web: Makefile .SUFFIXES: .tar.gz .c override CFLAGS += -Wall -O0 -g hello:hello.c all: hello hello.tar.gz %.tar.gz: DIR=$(subst .tar.gz,,$@) %.tar.gz: %.c @mkdir -p ./$(DIR)-0.1 @cp $^ Makefile ./$(DIR)-0.1 tar -cz -f $@ ./$(DIR)-0.1 In this case, hello.c contains a code of simple greeting to a console, and Makefile compiles the code, building on the platform, creates tar.gz archive with a source code and a make file in it, as well as a folder with similar content. Attention! Keeping tabs is a must! You can verify the accuracy by running the following commands (in ~/openwrt/hello) make all ./hello The first one will collect, compile and create an archive with a folder. The second one will launch the executive file compiled for the platform of the current machine. «Hello, World!» in the console indicates that this step was performed successfully. 3. Then, create a hello folder in ~/openwrt/attitude_adjustment/feeds/packages/utils folder cd ../ cd attitude_adjustment/feeds/packages/utils/ mkdir hello and open it cd hello/ 4. Create a make file in it for OpenWRT touch makefile 5. Record the following data in it include $(TOPDIR)/ PKG_NAME:=hello PKG_VERSION:=0 PKG_RELEASE:=1 PKG_BUILD_DIR:=$(PKG_NAME)-$(PKG_VERSION).$(PKG_RELEASE) PKG_SOURCE:=hello.tar.gz PKG_SOURCE_URL:=file:///home/user/openwrt/hello/ include $(INCLUDE_DIR)/ Componentality Oy Ratakatu 47, 53100 Lappeenranta, Finland Tel.: +358 046 5662016 Email: Web: define Package/hello SECTION:=utils CATEGORY:=Utilities TITLE:=HW endef define Package/hello/description Hello World endef define Package/hello/Build/Compile $(MAKE) -C $(PKG_BUILD_DIR) hello endef define Package/hello/install $(INSTALL_DIR) $(1)/bin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/hello $(1)/bin/hello endef $(eval $(call BuildPackage,hello)) Attention! Make sure to change user name in PKG_SOURCE_URL. III. Compilation 1. After proper make files configuring run the following commands from ~/openwrt/attitude_adjustment folder: ./scripts/feeds update -i ./scripts/feeds install hello 2. Open configuration menu once again make menuconfig 3. Find our package Utilites ----> hello And put [M] package parameter to it 4. Press Exit two times to exit and save 5. Run the following command make package/hello/compile In case of successful compilation, a ready hello_0-1_ar71xx.ipk executive file will appear in ~/openwrt/attitude_adjustment/bin/ar71xx/packages for starting on FlexRoad. IV. Moving and installation Componentality Oy Ratakatu 47, 53100 Lappeenranta, Finland Tel.: +358 046 5662016 Email: Web: 1. Move hello_0-1_ar71xx.ipk package to FlexRoad and install it. As an option you can copy hello_01_ar71xx.ipk to the root folder of the device using SCP utility. 2. Install the package using opkg install /root/hello_0-1_ar71xx.ipk command. 3. You can check its operation by entering the package name as a command in the console hello «Hello, World!» in the console indicates successful completion of all operations.




工业电子 汽车电子 个人消费电子