Changeset 13880


Ignore:
Timestamp:
2009-01-06T10:20:14+01:00 (9 years ago)
Author:
florian
Message:

Make the doc slightly more complete and add notes on how to add a new target in OpenWrt, some serial console and JTAG tips and tricks

Location:
trunk/docs
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/Makefile

    r12210 r13880  
    1010 
    1111MAIN = openwrt.tex 
    12 DEPS = $(MAIN) Makefile config.tex network.tex network-scripts.tex network-scripts.tex wireless.tex build.tex adding.tex bugs.tex $(TMP_DIR)/.prereq-docs 
     12DEPS = $(MAIN) Makefile config.tex network.tex network-scripts.tex network-scripts.tex wireless.tex build.tex adding.tex bugs.tex debugging.tex $(TMP_DIR)/.prereq-docs 
    1313 
    1414compile: $(TMP_DIR)/.prereq-docs 
  • trunk/docs/adding.tex

    r10129 r13880  
    479479MODULE_AUTHOR("Me, myself and I <memyselfandi@domain.tld"); 
    480480\end{verbatim} 
     481 
     482\subsection{Adding your target in OpenWrt} 
     483 
     484Once you spotted the key changes that were made to the Linux kernel 
     485to support your target, you will want to create a target in OpenWrt 
     486for your hardware. This can be useful to benefit from the toolchain 
     487that OpenWrt builds as well as the resulting user-space and kernel 
     488configuration options. 
     489 
     490Provided that your target is already known to OpenWrt, it will be 
     491as simple as creating a \texttt{target/linux/board} directory 
     492where you will be creating the following directories and files. 
     493 
     494Here for example, is a \texttt{target/linux/board/Makefile}: 
     495 
     496\begin{Verbatim}[frame=single,numbers=left] 
     497# 
     498# Copyright (C) 2009 OpenWrt.org 
     499# 
     500# This is free software, licensed under the GNU General Public License v2. 
     501# See /LICENSE for more information. 
     502# 
     503include $(TOPDIR)/rules.mk 
     504 
     505ARCH:=mips 
     506BOARD:=board 
     507BOARDNAME:=Eval board 
     508FEATURES:=squashfs jffs2 pci usb 
     509 
     510LINUX_VERSION:=2.6.27.10 
     511 
     512include $(INCLUDE_DIR)/target.mk 
     513 
     514DEFAULT_PACKAGES += hostapd-mini 
     515 
     516define Target/Description 
     517        Build firmware images for Evaluation board 
     518endef 
     519 
     520$(eval $(call BuildTarget)) 
     521\end{Verbatim} 
     522 
     523\begin{itemize} 
     524    \item \texttt{ARCH} \\ 
     525        The name of the architecture known by Linux and uClibc 
     526    \item \texttt{BOARD} \\ 
     527        The name of your board that will be used as a package and build directory identifier 
     528    \item \texttt{BOARDNAME} \\ 
     529        Expanded name that will appear in menuconfig 
     530    \item \texttt{FEATURES} \\ 
     531        Set of features to build filesystem images, USB, PCI, VIDEO kernel support 
     532    \item \texttt{LINUX\_VERSION} \\ 
     533        Linux kernel version to use for this target 
     534    \item \texttt{DEFAULT\_PACKAGES} \\ 
     535        Set of packages to be built by default 
     536\end{itemize} 
     537 
     538A partial kernel configuration which is either named \texttt{config-default} or which matches the kernel version \texttt{config-2.6.x} should be present in \texttt{target/linux/board/}. 
     539This kernel configuration will only contain the relevant symbols to support your target and can be changed using \texttt{make kernel\_menuconfig}. 
     540 
     541To patch the kernel sources with the patches required to support your hardware, you will have to drop them in \texttt{patches} or in \texttt{patches-2.6.x} if there are specific 
     542changes between kernel versions. Additionnaly, if you want to avoid creating a patch that will create files, you can put those files into \texttt{files} or \texttt{files-2.6.x} 
     543with the same directory structure that the kernel uses (e.g: drivers/mtd/maps, arch/mips ..). 
     544 
     545The build system will require you to create a \texttt{target/linux/board/image/Makefile}: 
     546 
     547\begin{Verbatim}[frame=single,numbers=left] 
     548# 
     549# Copyright (C) 2009 OpenWrt.org 
     550# 
     551# This is free software, licensed under the GNU General Public License v2. 
     552# See /LICENSE for more information. 
     553# 
     554include $(TOPDIR)/rules.mk 
     555include $(INCLUDE_DIR)/image.mk 
     556 
     557define Image/BuildKernel 
     558        cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(BOARD)-vmlinux.elf 
     559        gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz 
     560        $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7 
     561        dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.lzma bs=65536 conv=sync 
     562        dd if=$(KDIR)/vmlinux.bin.gz of=$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.gz bs=65536 conv=sync 
     563endef 
     564 
     565define Image/Build/squashfs 
     566    $(call prepare_generic_squashfs,$(KDIR)/root.squashfs) 
     567endef 
     568 
     569define Image/Build 
     570        $(call Image/Build/$(1)) 
     571        dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-root.$(1) bs=128k conv=sync 
     572 
     573        -$(STAGING_DIR_HOST)/bin/mkfwimage \ 
     574                -B XS2 -v XS2.ar2316.OpenWrt \ 
     575                -k $(BIN_DIR)/openwrt-$(BOARD)-vmlinux.lzma \ 
     576                -r $(BIN_DIR)/openwrt-$(BOARD)-root.$(1) \ 
     577                -o $(BIN_DIR)/openwrt-$(BOARD)-ubnt2-$(1).bin 
     578endef 
     579 
     580$(eval $(call BuildImage)) 
     581 
     582\end{Verbatim} 
     583 
     584\begin{itemize} 
     585    \item \texttt{Image/BuildKernel} \\ 
     586        This template defines changes to be made to the ELF kernel file 
     587    \item \texttt{Image/Build} \\ 
     588        This template defines the final changes to apply to the rootfs and kernel, either combined or separated 
     589        firmware creation tools can be called here as well. 
     590\end{itemize} 
  • trunk/docs/openwrt.tex

    r9996 r13880  
    3131     \input{adding} 
    3232  \section{Debugging and debricking} 
    33     \subsection{Adding a serial port} 
    34     \subsection{JTAG} 
     33     \input{debugging} 
    3534   \section{Reporting bugs} 
    3635        \subsection{Using the Trac ticket system} 
Note: See TracChangeset for help on using the changeset viewer.