Skip to content

Instantly share code, notes, and snippets.

@routevegetable
Last active January 28, 2017 23:07
Show Gist options
  • Save routevegetable/6b33879c71204a072ad6842f74b7d85a to your computer and use it in GitHub Desktop.
Save routevegetable/6b33879c71204a072ad6842f74b7d85a to your computer and use it in GitHub Desktop.
A script to care of recompiling CHIP kernel & modules, and then rsyncing
#!/bin/bash
# Script to automate the stuff in http://www.raspibo.org/wiki/index.php/Compile_the_Linux_kernel_for_Chip:_my_personal_HOWTO
IP=192.168.0.24
MYDIR=`pwd`
BUILD_DIR=`pwd`/build
KVER=4.3.0bizarrefish+
set -e
# Clean build directory
rm -rf $BUILD_DIR
mkdir $BUILD_DIR
# Build kernel
make -j 9 ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- INSTALL_MOD_PATH=$BUILD_DIR zImage modules modules_install
# Build wifi module
make -j 9 CONFIG_PLATFORM_ARM_SUNxI=y ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -C $MYDIR M=RTL8723BS CONFIG_RTL8723BS=m INSTALL_MOD_PATH=$BUILD_DIR
make CONFIG_PLATFORM_ARM_SUNxI=y ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- -C $MYDIR M=RTL8723BS CONFIG_RTL8723BS=m INSTALL_MOD_PATH=$BUILD_DIR modules_install
# Fix 'firmware' directory
mkdir $BUILD_DIR/lib/fw
mv $BUILD_DIR/lib/firmware $BUILD_DIR/lib/fw/$KVER
mv $BUILD_DIR/lib/fw $BUILD_DIR/lib/firmware
# Put things in the right place
mkdir $BUILD_DIR/boot
cp -v arch/arm/boot/zImage $BUILD_DIR/boot/zImage
cp -v .config $BUILD_DIR/boot/config-$KVER
cp -v System.map $BUILD_DIR/boot/System.map-$KVER
# Copy things to the target
rsync -zavh $BUILD_DIR/ root@$IP:/
# Must depmod -a afterward!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment