forked from Red54/linux-shumeipai2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sun4i] add build scripts and default config
- Loading branch information
Showing
4 changed files
with
373 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
PLATFORM="" | ||
MODULE="" | ||
|
||
show_help() | ||
{ | ||
printf "\nbuild.sh - Top level build scritps\n" | ||
echo "Valid Options:" | ||
echo " -h Show help message" | ||
echo " -p <platform> platform, e.g. sun4i, sun4i-lite, sun4i_crane" | ||
printf " -m <module> module\n\n" | ||
} | ||
|
||
while getopts hp:m: OPTION | ||
do | ||
case $OPTION in | ||
h) show_help | ||
;; | ||
p) PLATFORM=$OPTARG | ||
;; | ||
m) MODULE=$OPTARG | ||
;; | ||
*) show_help | ||
;; | ||
esac | ||
done | ||
|
||
if [ -z "$PLATFORM" ]; then | ||
show_help | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$MODULE" ]; then | ||
MODULE="all" | ||
fi | ||
|
||
if [ -x ./scripts/build_${PLATFORM}.sh ]; then | ||
./scripts/build_${PLATFORM}.sh $MODULE | ||
else | ||
printf "\nERROR: Invalid Platform\n" | ||
show_help | ||
exit 1 | ||
fi | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#!/bin/bash | ||
set -e | ||
######################################################################### | ||
# | ||
# Simple build scripts to build krenel(with rootfs) -- by Benn | ||
# | ||
######################################################################### | ||
|
||
|
||
#Setup common variables | ||
export ARCH=arm | ||
export CROSS_COMPILE=arm-none-linux-gnueabi- | ||
export AS=${CROSS_COMPILE}as | ||
export LD=${CROSS_COMPILE}ld | ||
export CC=${CROSS_COMPILE}gcc | ||
export AR=${CROSS_COMPILE}ar | ||
export NM=${CROSS_COMPILE}nm | ||
export STRIP=${CROSS_COMPILE}strip | ||
export OBJCOPY=${CROSS_COMPILE}objcopy | ||
export OBJDUMP=${CROSS_COMPILE}objdump | ||
|
||
KERNEL_VERSION="3.0" | ||
LICHEE_KDIR=`pwd` | ||
LICHEE_MOD_DIR==${LICHEE_KDIR}/output/lib/modules/${KERNEL_VERSION} | ||
|
||
CONFIG_CHIP_ID=1123 | ||
|
||
update_kern_ver() | ||
{ | ||
if [ -r include/generated/utsrelease.h ]; then | ||
KERNEL_VERSION=`cat include/generated/utsrelease.h |awk -F\" '{print $2}'` | ||
fi | ||
LICHEE_MOD_DIR=${LICHEE_KDIR}/output/lib/modules/${KERNEL_VERSION} | ||
} | ||
|
||
show_help() | ||
{ | ||
printf "Build script for Lichee system\n" | ||
printf " Invalid Option:\n" | ||
printf " help - show this help\n" | ||
printf " kernel - build kernel for sun4i\n" | ||
printf " modules - build external modules for sun4i\n" | ||
printf " clean - clean all\n" | ||
printf "\n" | ||
} | ||
|
||
|
||
build_kernel() | ||
{ | ||
if [ ! -e .config ]; then | ||
echo -e "\n\t\tUsing default config... ...!\n" | ||
cp arch/arm/configs/sun4i_defconfig .config | ||
|
||
fi | ||
|
||
make KALLSYMS_EXTRA_PASS=1 ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} -j8 | ||
update_kern_ver | ||
|
||
if [ -d output ]; then | ||
rm -rf output | ||
fi | ||
mkdir -p $LICHEE_MOD_DIR | ||
|
||
${OBJCOPY} -R .note.gnu.build-id -S -O binary vmlinux output/bImage | ||
cp -vf arch/arm/boot/[zu]Image output/ | ||
cp .config output/ | ||
|
||
|
||
for file in $(find drivers sound crypto block fs security net -name "*.ko"); do | ||
cp $file ${LICHEE_MOD_DIR} | ||
done | ||
cp -f Module.symvers modules.* ${LICHEE_MOD_DIR} | ||
} | ||
|
||
build_modules() | ||
{ | ||
echo "Building modules" | ||
} | ||
|
||
clean_kernel() | ||
{ | ||
make clean | ||
rm -rf output/* | ||
} | ||
|
||
clean_modules() | ||
{ | ||
echo "Cleaning modules" | ||
} | ||
|
||
##################################################################### | ||
# | ||
# Main Runtine | ||
# | ||
##################################################################### | ||
|
||
LICHEE_ROOT=`(cd ${LICHEE_KDIR}/..; pwd)` | ||
export PATH=${LICHEE_ROOT}/buildroot/output/external-toolchain/bin:$PATH | ||
|
||
case "$1" in | ||
kernel) | ||
build_kernel | ||
;; | ||
modules) | ||
build_modules | ||
;; | ||
clean) | ||
clean_kernel | ||
clean_modules | ||
;; | ||
all) | ||
build_kernel | ||
build_modules | ||
;; | ||
*) | ||
show_help | ||
;; | ||
esac | ||
|
Oops, something went wrong.