-
Notifications
You must be signed in to change notification settings - Fork 1
/
overo-image-create-base
executable file
·73 lines (60 loc) · 2.03 KB
/
overo-image-create-base
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
set -e
source settings.env
if [ -n "${1}" ]
then
U_OE_IMAGE=${1}
fi
if [ ! -n "${U_OE_HOME}" ] || [ ! -n "${U_OE_IMAGE}" ] || [ ! -n "${U_OE_IMAGE_DIR}" ] || [ ! -n "${U_IMAGE_ROOT}" ] || [ ! -n "${U_IMAGE_BOOT}" ]
then
echo '${U_OE_HOME} or ${U_OE_IMAGE} or ${U_IMAGE_ROOT} or ${U_IMAGE_BOOT} is not set in settings.env'
exit 1
fi
CURDIR=`pwd`
cd ${U_OE_HOME}/
if [ -n "${U_OE_CHECKOUT}" ]
then
cd org.openembedded.dev
git checkout ${U_OE_CHECKOUT}
cd -
fi
# Building the bitbake image
echo "Building bitbake image."
echo "This takes several hours the first time, but (usually) just a few minutes any subsequent time"
bitbake ${U_OE_IMAGE}
echo ""
echo "Finished building ${U_OE_IMAGE}"
echo ""
# Building the bitbake boot files
echo "Building bitbake boot files."
echo "This should take a mere minute or two"
bitbake x-load u-boot-omap3 virtual/kernel
echo ""
echo "Finished building boot files"
echo ""
cd ${CURDIR} # ${U_OE_HOME}
# Create system Image
# TODO ask for confirmation a mistake with 'rm -rf' would be a disaster
echo "Recreating the root partition base (overlay must be added again afterwards)"
echo "This shouldn't take more than a minute on a hard drive"
echo "sudo-ing 'tar xf ${U_OE_IMAGE_DIR}/${U_OE_IMAGE}-${U_OE_MACHINE}.tar.bz2 -C ${U_IMAGE_ROOT}/' to preserve 'root' permissions"
sudo rm -rf ${U_IMAGE_ROOT}
mkdir -p ${U_IMAGE_ROOT}
sudo tar xf ${U_OE_IMAGE_DIR}/${U_OE_IMAGE}-${U_OE_MACHINE}.tar.bz2 -C ${U_IMAGE_ROOT}/
echo ""
echo "Finished copying root files to ${U_IMAGE_ROOT}"
echo ""
# Create boot Image
echo "Recreating the boot partition base"
echo "This should take a mere second or two"
rm -rf ${U_IMAGE_BOOT}
mkdir -p ${U_IMAGE_BOOT}
cp ${U_OE_IMAGE_DIR}/MLO-${U_OE_MACHINE} ${U_IMAGE_BOOT}/MLO
cp ${U_OE_IMAGE_DIR}/u-boot-${U_OE_MACHINE}.bin ${U_IMAGE_BOOT}/u-boot.bin
cp ${U_OE_IMAGE_DIR}/uImage-${U_OE_MACHINE}.bin ${U_IMAGE_BOOT}/uImage
cp mkbootscript ${U_IMAGE_BOOT}/
cp bootscript.tpl ${U_IMAGE_BOOT}/
echo ""
echo "Finished copying boot files to ${U_IMAGE_BOOT}"
echo ""
overo-image-pre-overlay