Browse Source

Merge pull request #33 from hekkup/master

Added USB & V4L modules to the build script
master
Dhruv Vyas 8 years ago
committed by GitHub
parent
commit
05a54bc35f
  1. 2
      tools/README.md
  2. 55
      tools/build-kernel-qemu

2
tools/README.md

@ -3,6 +3,8 @@ In this subsection, I've included tools and instructions for those who want to b
`build-kernel-qemu` script helps one to automate kernel building process for any debian based distro.
The ARM toolchain can be found in the debian package gcc-arm-linux-gnueabihf or at https://github.com/raspberrypi/tools. For other OSes, like windows or Mac OS X, one can have similar tools like gcc-arm-linux-gnueabihf- and other dependencies and refer `build-kernel-qemu` line by line to build the kernel.
If you enable USB webcam modules in the build script, make sure that the correct drivers for your web camera are selected in menuconfig. A word of warning, though: USB works in Qemu in general but USB web cameras have some problems actually.
Please note that `build-kernel-qemu` is not an original work of mine and credit for it goes to the original author (https://github.com/johnlane).
I've taken building references from the links below:

55
tools/build-kernel-qemu

@ -10,6 +10,7 @@ COMMIT=raspberrypi-kernel_1.20161100-1
COMMIT=""
INSTALL_PACKAGES=""
USE_GIT=1
USB_WEBCAM_MODULES="" # add USB & V4L modules for USB webcam support (didn't work as static)
if [ -f build-kernel-qemu.conf ] ; then
. build-kernel-qemu.conf
@ -26,7 +27,7 @@ if [ "$USE_GIT" ] ; then
if [ ! -d linux ] ; then
git clone https://github.com/raspberrypi/linux.git
else
echo "using existing linux sources!"
echo "Using existing Linux sources!"
fi
cd linux
if [ "$COMMIT" ] ; then
@ -44,7 +45,9 @@ patch -p1 < ../linux-arm.patch
make ARCH=arm versatile_defconfig
KERNEL_VERSION=$(make kernelversion)
echo "building qemu raspberry pi kernel kernel-qemu-$KERNEL_VERSION"
KERNEL_TARGET_FILE_NAME=../qemu-kernel-$KERNEL_VERSION
MODULES_INSTALL_PATH=../qemu-kernel-$KERNEL_VERSION-modules
echo "Building Qemu Raspberry Pi kernel qemu-kernel-$KERNEL_VERSION"
cat >> .config << EOF
CONFIG_CROSS_COMPILE="$TOOLCHAIN"
@ -89,9 +92,55 @@ CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
EOF
if [ $USB_WEBCAM_MODULES ] ; then
echo "Make sure you have drivers for your webcam selected in menuconfig"
echo >> .config << EOF
# won't work as statically linked
CONFIG_MEDIA_SUPPORT=m
CONFIG_VIDEO_DEV=m
CONFIG_VIDEO_V4L2_COMMON=m
CONFIG_VIDEO_MEDIA=m
CONFIG_VIDEO_V4L2=m
CONFIG_VIDEO_CAPTURE_DRIVERS=m
CONFIG_V4L_USB_DRIVERS=m
CONFIG_USB_VIDEO_CLASS=m
CONFIG_VIDEO_CORE=m
CONFIG_VIDEO_VIDEOBUF2=m
CONFIG_INPUT_CORE=m
CONFIG_VIDEO_UVC=m
CONFIG_USB=m
CONFIG_USB_STORAGE=m
CONFIG_USB_EHCI_HCD=m
CONFIG_USB_OHCI_HCD=m
CONFIG_USB_UHCI_HCD=m
CONFIG_USB_VHCI_HCD=m
CONFIG_USB_GSPCA=m
CONFIG_VIDEO_GSPCA=m
CONFIG_I2C=m
# won't be accepted as modules so linking statically
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
CONFIG_MEDIA_CAMERA_SUPPORT=y
EOF
fi
cat ../config_ip_tables >> .config
make -j 4 -k ARCH=arm CROSS_COMPILE=${TOOLCHAIN}- menuconfig
make -j 4 -k ARCH=arm CROSS_COMPILE=${TOOLCHAIN}- bzImage
cp arch/arm/boot/zImage ../kernel-qemu-$KERNEL_VERSION
cp arch/arm/boot/zImage $KERNEL_TARGET_FILE_NAME
if [ $USB_WEBCAM_MODULES ] ; then
mkdir -p $MODULES_INSTALL_PATH
if [ ! -d $MODULES_INSTALL_PATH ] ; then
echo "Couldn't create webcam modules install directory $MODULES_INSTALL_PATH"
fi
make -j 4 -k ARCH=arm CROSS_COMPILE=${TOOLCHAIN}- modules
make -j 4 -k ARCH=arm CROSS_COMPILE=${TOOLCHAIN}- \
INSTALL_MOD_PATH=$MODULES_INSTALL_PATH modules_install
echo "Copy modules to Raspberry to /lib/modules/$KERNEL_VERSION"
fi
cd ..

Loading…
Cancel
Save