<p>Usage and documentation by Felix Fietkau and Waldemar Brodkorb, based on uClibc Buildroot
documentation by Thomas Petazzoni. Contributions from Karsten Kruse,
- Ned Ludd, Martin Herren.</p>
+ Ned Ludd, Martin Herren. OpenWrt Kernel Module Creation Howto by Markus Becker.</p>
<p><small>Last modification : $Id$</small></p>
<li><a href="#downloaded_packages">Location of downloaded packages</a></li>
<li><a href="#add_software">Extending OpenWrt with more Software</a></li>
<li><a href="#links">Ressources</a></li>
+<br>
+ <li><a href="#about_module">About OpenWrt Kernel Module Compilation</a></li>
+ <li><a href="#kernel">Enable the kernel options</a></li>
+ <li><a href="#buildroot_option">Create a buildroot option</a></li>
+ <li><a href="#binary">Define the binary files for the kernel module</a></li>
+ <li><a href="#control">Specify the ipkg control file</a></li>
+ <li><a href="#compile">Compile the kernel module</a></li>
+
</ul>
<h2><a name="about" id="about"></a>About OpenWrt Buildroot</h2>
<h2><a name="download" id="download"></a>Obtaining OpenWrt Buildroot</h2>
<p>OpenWrt Buildroot is available via CVS - Concurrent Version System.
- For any kind of development you should get the latest version from cvs via:</p>
+ For any kind of OpenWrt development you should get the latest version from cvs via:</p>
<pre>
$ cvs -d:pserver:anonymous@openwrt.org:/openwrt co openwrt
</pre>
+ <p>If you only like to create your own custom firmware images and pakages we
+ strongely suggest to use the CVS branch of the stable version (whiterussian):
+ </p>
+<pre>
+ $ cvs -d:pserver:anonymous@openwrt.org:/openwrt co -rwhiterussian openwrt
+</pre>
+
<h2><a name="using" id="using"></a>Using OpenWrt Buildroot</h2>
<h2><a name="custom_targetfs" id="custom_targetfs"></a>Customizing the
target filesystem</h2>
- <p>There are two ways to customize the resulting target filesystem:</p>
-
- <ul>
- <li>Customize the target filesystem directly, and rebuild the image. The
- target filesystem is available under <code>build_ARCH/root/</code> where
- <code>ARCH</code> is the chosen target architecture, usually mipsel.
- You can simply make your changes here, and run make target_install afterwards,
- which will rebuild the target filesystem image. This method allows to do
- everything on the target filesystem, but if you decide to rebuild your toolchain,
- tools or packages, these changes will be lost.</li>
-
- <li>Customize the target filesystem skeleton, available under
- <code>target/default/target_skeleton/</code>. You can customize
- configuration files or other stuff here. However, the full file hierarchy
- is not yet present, because it's created during the compilation process.
- So you can't do everything on this target filesystem skeleton, but
- changes to it remains even when you completely rebuild the cross-compilation
- toolchain and the tools.<br />
- </ul>
+ <li>You can customize the target filesystem skeleton, available under
+ <code>package/base-files/default/</code>. You can change
+ configuration files or other stuff here. However, the full file hierarchy
+ is not yet present, because it's created during the compilation process.
+ So you can't do everything on this target filesystem skeleton, but
+ changes to it remains even when you completely rebuild the cross-compilation
+ toolchain and the tools.<br />
<h2><a name="custom_busybox" id="custom_busybox"></a>Customizing the
Busybox configuration</h2>
18
19 $(eval $(call PKG_template,FOO,foo,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
20
- 21 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
+ 21 $(PKG_BUILD_DIR)/.configured:
22 (cd $(PKG_BUILD_DIR); \
23 $(TARGET_CONFIGURE_OPTS) \
24 CFLAGS="$(TARGET_CFLAGS)" \
recursevily strip all binaries and libraries.
Finally <code>IPKG_BUILD</code> is called to create the package.</p>
+ <p>If you want other targets to be executed at <code>compile</code>,
+ <code>install</code> or <code>clean</code> time (e.g. for installing
+ a library into the staging dir), just create the targets (usually
+ <code>install-dev</code> and <code>uninstall-dev</code>) and enable
+ them like this:
+<pre>
+compile-targets: install-dev
+clean-targets: uninstall-dev
+</pre>
+
<h3>Conclusion</h3>
<p>As you can see, adding a software to buildroot is simply a
<p>If you package software that might be useful for other persons,
don't forget to send a patch to OpenWrt developers!
- Use the mail address: patches@openwrt.org
+ Use the mail address: openwrt-devel@openwrt.org
</p>
<h2><a name="links" id="links"></a>Resources</h2>
- <p>To learn more about OpenWrt you can visit this website:
+ <p>To learn more about OpenWrt, you can visit this website:
<a href="http://openwrt.org/">http://openwrt.org/</a></p>
</div>
+
+ <div class="main">
+ <div class="titre">
+ <h1>OpenWrt Kernel Module Creation Howto</h1>
+ </div>
+
+ <h2><a name="about_module" id="about_module"></a>About OpenWrt Kernel Module Compilation</h2>
+
+ <p>You are planning to compile a kernel module? This howto will
+explain what you have to do, to have your kernel module installable as
+an ipkg.</p>
+
+ <h2><a name="kernel" id="kernel"></a>Enable the kernel options</h2>
+
+ <p>Enable the kernel options you want by modifying
+build_mipsel/linux/.config. We are assuming, that you already had your
+kernel compiled once here. You can do the modification by hand or by
+
+<pre>
+$ cd build_mipsel/linux
+$ make menuconfig
+</pre>
+
+And copy it, so your changes are not getting lost, when doing a 'make
+dirclean'. Here we assume that you are compiling for Broadcom chipset
+based devices:
+
+<pre> $ cp .config ../../../target/linux/linux-2.4/config/brcm </pre>
+
+</p>
+ <h2><a name="buildroot_option" id="buildroot_option"></a>Create a buildroot option</h2>
+
+ <p>Create a buildroot option by modifying/inserting into
+target/linux/Config.in, e.g.
+
+<pre>
+config BR2_PACKAGE_KMOD_USB_KEYBOARD
+ tristate "Support for USB keyboards"
+ default m
+ depends BR2_PACKAGE_KMOD_USB_CONTROLLER
+</pre>
+</p>
+
+ <h2><a name="binary" id="binary"></a>Define the binary files for the kernel module</h2>
+
+ <p>Define the binary files for the kernel module by modifying/inserting into
+target/linux/linux-2.4/Makefile, e.g.
+
+<pre>
+$(eval $(call KMOD_template,USB_KEYBOARD,usb-kbd,\
+ $(MODULES_DIR)/kernel/drivers/input/input.o \
+ $(MODULES_DIR)/kernel/drivers/input/keybdev.o \
+ $(MODULES_DIR)/kernel/drivers/usb/usbkbd.o \
+,CONFIG_USB_KEYB,kmod-usb-core,60,input keybdev usbkbd))
+</pre>
+
+Where CONFIG_USB_KEYB is the kernel option, USB_KEYBOARD is the last
+part of BR2_PACKAGE_KMOD_USB_KEYBOARD and usb-kbd is part of the
+filename of the created ipkg.</p>
+
+ <h2><a name="control" id="control"></a>Specify the ipkg control file</h2>
+
+ <p>Create e.g. target/linux/control/kmod-usb-kbd.control with content similar to this:
+
+<pre>
+Package: kmod-usb-kbd
+Priority: optional
+Section: sys
+Maintainer: Markus Becker <mab@comnets.uni-bremen.de>
+Source: buildroot internal
+Description: Kernel Support for USB Keyboards
+</pre>
+ </p>
+
+ <h2><a name="compile" id="compile"></a>Compile the kernel module</h2>
+
+ <p>Enable the kernel module with
+<pre>
+$ make menuconfig
+</pre>
+ in TOPDIR and selecting it.<br>
+
+ Compile with
+<pre>
+$ make dirclean && make
+</pre>
+ </p>
+ </div>
+
</body>
</html>