How To Make A Custom Kernel
From TouchDroid Public Wiki
This sourced from: http://www.webos-internals.org/wiki/Custom_Kernels
Contents |
Toolchain
Download the 2009q1 ARM toolchain
tar xjvf arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 sudo mv arm-2009q1 /usr/local/arm
Environment
Create a file: /usr/local/pre/setup-env
:
export PRETOOL_DIR="/usr/local/arm" (echo "$PATH" | grep -q "${PRETOOL_DIR}") || export PATH="${PRETOOL_DIR}/bin:${PATH}" export STRIP="arm-none-linux-gnueabi-strip" export LD="arm-none-linux-gnueabi-ld" export CC="arm-none-linux-gnueabi-gcc -march=armv4t -mtune=arm920t" export CPPFLAGS="-isystem${PRETOOL_DIR}/arm/arm-none-linux-gnueabi/include" export RANLIB="arm-none-linux-gnueabi-ranlib" export CXX="arm-none-linux-gnueabi-g++ -march=armv4t -mtune=arm920t" export OBJCOPY="arm-none-linux-gnueabi-objcopy" export PKG_CONFIG_PATH="${PRETOOL_DIR}/usr/local/lib/pkgconfig" export PKG_CONFIG_SYSROOT_DIR="${PRETOOL_DIR}/arm/arm-none-linux-gnueabi" #export LDFLAGS="-L${PRETOOL_DIR}/usr/local/lib -Wl,-rpath-link,${PRETOOL_DIR}/arm/arm-none-linux-gnueabi/lib -Wl,-O1" export CCLD="arm-none-linux-gnueabi-gcc -march=armv4t -mtune=arm920t" export MAKE="make" export CFLAGS="-isystem${PRETOOL_DIR}/usr/local/include -fexpensive-optimizations -fomit-frame-pointer -frename-registers -Os" export CXXFLAGS="-isystem${PRETOOL_DIR}/arm/arm-none-linux-gnueabi/include -fexpensive-optimizations -fomit-frame-pointer -frename-registers -Os -fpermissive -fvisibility-inlines-hidden" export F77="arm-none-linux-gnueabi-g77 -march=armv4t -mtune=arm920t" export AS="arm-none-linux-gnueabi-as" export AR="arm-none-linux-gnueabi-ar" export CPP="arm-none-linux-gnueabi-gcc -E" export OBJDUMP="arm-none-linux-gnueabi-objdump" export CONFIG_SITE="${PRETOOL_DIR}/arm/site-config"Run
. /usr/local/pre/setup-envto set up your environment.
mkimage
mkimage is part of u-boot and is required to build a kernel image. On ubuntu you can install the uboot-mkimage
package. Other dists may have similar packages. To build it from source:
- Create compiler symlinks
cd /usr/local/arm/bin ln -s arm-none-linux-gnueabi-gcc arm-linux-gcc ln -s arm-none-linux-gnueabi-ar arm-linux-ar ln -s arm-none-linux-gnueabi-ld arm-linux-ld ln -s arm-none-linux-gnueabi-objcopy arm-linux-objcopy ln -s arm-none-linux-gnueabi-objdump arm-linux-objdump ln -s arm-none-linux-gnueabi-nm arm-linux-nm
- Download the u-boot tarball.
- Extract the tarball and cd into u-boot-2009.06
- Compile
make omap3_beagle_config && make
- mkimage is in the tools subdirectory. Copy it into /usr/local/bin
Build the kernel
- Download the prepatched kernel sources. (These are now superseded by the sources available at [http://goo.gl/NZQ7z this link, thanks to jonpry>
- Download the config and put it in the linux-2.6.35 directory and name it
.config
(this is superseded - run "make tenderloin_defconfig" to generate the config file) - Run make
make && make uImage
- Optional Flags for Optimization: -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
See More
http://www.webos-internals.org/wiki/Research_Pre_Boot_Process