aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: a277eb23411049bf2283ca4ea1f7e6adf8f633ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
#
# kernel build script for apollo3g 
#
# Usage: 'sh build.sh' to just use defaults (need to have the ELDK installed)
#        'sh build.sh CROSS_COMPILE ARCH OUTLOC' to specifiy all parameters
#
if [ "${1}" = "--copyroot" ]; then
    shift
    ROOTFS_PATH=${1}
    shift
fi
_CROSS_COMPILE=${1:-ppc_4xxFP-}
_ARCH=${2:-powerpc}
OUTLOC=${3:-_BuildOutput}
if [ ! -d ${OUTLOC} ]; then 
    mkdir -p "${OUTLOC}"
fi

echo =========== Building Linux ===============
make distclean
make mrproper
make O=${OUTLOC} CROSS_COMPILE=${_CROSS_COMPILE} ARCH=${_ARCH} 44x/apollo_3G_nas_defconfig
make O=${OUTLOC} CROSS_COMPILE=${_CROSS_COMPILE} ARCH=${_ARCH} -j 5 uImage

echo
echo =========== Building device tree ===========
make O=${OUTLOC} CROSS_COMPILE=${_CROSS_COMPILE} ARCH=${_ARCH} -j 5 apollo3g.dtb

echo
echo =========== Building modules ===========
make O=${OUTLOC} CROSS_COMPILE=${_CROSS_COMPILE} ARCH=${_ARCH} -j 5 modules 
make INSTALL_MOD_PATH=$(pwd)/modules O=${OUTLOC} CROSS_COMPILE=${_CROSS_COMPILE} ARCH=${_ARCH} -j 5 modules_install

echo
echo "=========== Copying images to directory $(pwd) ============"
cp -v ${OUTLOC}/arch/powerpc/boot/uImage .
cp -v ${OUTLOC}/arch/powerpc/boot/apollo3g.dtb .
ls -ll *.dtb uImage

if [ ! -z "${ROOTFS_PATH}" ]; then
echo
echo "=========== Copying images and modules to rootfs directory at ${ROOTFS_PATH} ============"
    cp -v -r --remove-destination ${OUTLOC}/arch/powerpc/boot/uImage ${ROOTFS_PATH}/boot
    cp -v -r --remove-destination ${OUTLOC}/arch/powerpc/boot/apollo3g.dtb ${ROOTFS_PATH}/boot
    cp -v -p -r --remove-destination $(pwd)/modules/lib/modules/* ${ROOTFS_PATH}/lib/modules/  # */
fi

echo "=========== Done ============"

# We don't use the combined image
#echo
#echo =========== Combining images ===============
#dd if=/dev/zero of=apollo3g_boot.img bs=1 count=5M
#dd if=${OUTLOC}/arch/powerpc/boot/uImage of=apollo3g_boot.img conv=notrunc bs=1
#dd if=${OUTLOC}/arch/powerpc/boot/apollo3g.dtb of=apollo3g_boot.img conv=notrunc bs=1 seek=4M