Commit f7863074 authored by papauxg's avatar papauxg
Browse files

moved common build functions

parent 1de6c6f7
#!/bin/bash
# Please define needed vars before calling this script
main() {
mkdir -p ${INST_PATH}
do_kernel
do_dtb
}
function do_kernel() {
kernel_fetch
cd ${KERNEL_BUILD_DIR}
kernel_patch
kernel_configure
kernel_compile
cd -
}
function do_dtb() {
echo "Creating dtb..."
# ${DTC_PATH} -O dtb -o ${DTB_FILE} ${DTS_FILE}
cp ${DTB_FILE} ${INST_PATH}
}
function kernel_patch() {
echo "Patching kernel..."
# nothing
}
function kernel_fetch() {
echo "Fetching kernel..."
if [ -d "$KERNEL_BUILD_DIR" ]; then
echo "Kernel directory already exists, using it..."
else
git clone ${KERNEL_GIT_SRC} ${KERNEL_BUILD_DIR}
cd ${KERNEL_BUILD_DIR}
git checkout ${KERNEL_GIT_BRANCH} -b local/${KERNEL_GIT_BRANCH}
cd -
fi
}
function kernel_configure() {
echo "Configuring kernel..."
# default config target set ?
if [[ ! -z "$KERNEL_DEFCONFIG" ]]
then
make ${KERNEL_DEFCONFIG}
fi
# default config file set ?
if [[ ! -z "$KERNEL_CONFIG_FILE" ]]
then
cp ../${KERNEL_CONFIG_FILE} .config
fi
}
function kernel_compile() {
echo "Compiling kernel..."
make -j${BUILD_NB_THREADS}
make -j${BUILD_NB_THREADS} modules
make modules_install INSTALL_MOD_PATH=../${MODULES_INST_PATH}
cp arch/arm/boot/zImage ../${INST_PATH}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment