Skip to content

Commit

Permalink
Update build-kernel-qemu for hard-float
Browse files Browse the repository at this point in the history
  • Loading branch information
John Lane committed Jan 20, 2013
1 parent dff2da4 commit 9869270
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 49 deletions.
1 change: 1 addition & 0 deletions kernel/.gitignore
@@ -0,0 +1 @@
kernel-qemu/
46 changes: 0 additions & 46 deletions kernel/README

This file was deleted.

31 changes: 31 additions & 0 deletions kernel/README.md
@@ -0,0 +1,31 @@
Kernel Build Notes
==================

QEMU ARM Emulator
-----------------

Use the script 'build-kernel-qemu' to build a kernel image that
can be used to boot QEMU. The script can build a soft or hard
float kernel. (for soft-float, comment out "HARDFLOAT=yes" near
the top of the script).

Assumptions
-----------

An appropriate cross compiler toolchain is available at:

* for soft float : /usr/bin/arm-linux-gnueabi-*
* for hard float : /usr/bin/arm-linux-gnueabihf-*

Tests
-----

Tested by booting Raspberry-Pi Arch Linux system images in QEMU:

* for soft float : archlinuxarm-13-06-2012.img
* for hard float : archlinux-hf-2012-09-18.img

References
----------
http://xecdesign.com/compiling-a-kernel/
http://balau82.wordpress.com/2010/03/22/compiling-linux-kernel-for-qemu-arm-emulator/
33 changes: 30 additions & 3 deletions kernel/build-kernel-qemu 100644 → 100755
@@ -1,5 +1,25 @@
#!/bin/bash
#
# Build ARM kernel for QEMU Raspberry Pi Emulation
#
# John Lane https://github.com/johnlane/rpi-utils
#
# Thanks to http://xecdesign.com/compiling-a-kernel/
#
#######################################################

# Compile for hard-float ?
HARDFLOAT=yes

if [[ ${HARDFLOAT} == yes ]]; then
TOOLCHAIN=arm-linux-gnueabihf
CONFIG_VFP=y
else
TOOLCHAIN=arm-linux-gnueabi
CONFIG_VFP=n
fi

rm -rf kernel-qemu
mkdir kernel-qemu
cd kernel-qemu
git clone --depth 1 git://github.com/raspberrypi/linux.git
Expand All @@ -8,7 +28,7 @@ patch -p1 -d linux/ < linux-arm.patch
cd linux
make ARCH=arm versatile_defconfig
cat >> .config << EOF
CONFIG_CROSS_COMPILE="$(which arm-linux-gnueabi-gcc | sed "s/-gcc/-/")"
CONFIG_CROSS_COMPILE="$(which ${TOOLCHAIN}-gcc | sed "s/-gcc/-/")"
CONFIG_CPU_V6=y
CONFIG_ARM_ERRATA_411920=y
CONFIG_ARM_ERRATA_364296=y
Expand All @@ -23,11 +43,18 @@ CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_TMPFS=y
CONFIG_INPUT_EVDEV=y
CONFIG_EXT3_FS=y
CONFIG_EXT4_FS=y
CONFIG_VFAT_FS=y
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_FONT_8x16=y
CONFIG_LOGO=y
CONFIG_VFP=${CONFIG_VFP}
CONFIG_CGROUPS=y
EOF
make -j 8 -k ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig
make -j 8 -k ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

make -j 8 -k ARCH=arm CROSS_COMPILE=${TOOLCHAIN}- menuconfig
make -j 8 -k ARCH=arm CROSS_COMPILE=${TOOLCHAIN}-
cd ..
cp linux/arch/arm/boot/zImage kernel-qemu

0 comments on commit 9869270

Please sign in to comment.