allwinner_a64/lichee/buildroot/target/common/scripts/build.sh
August a32f4aeefd dragon: fix pack fail issue
* Since, 8.0(O), due to this commit https://android.googlesource.com/platform/system/extras/+/63362e153f799f41d3e0dd256d8b8281da3f2672 , cache.img compilation gets failed .

* Reason is when we set the size of ext4 file to a group size of 128M(in our case, cache.img size is 128mb), it get crashed when compile a ext4 file because:
  group size = Blocks per group(32768) * Block size(4096)
  last_group_size is set to 0 and aux_info.groups to 1
  But, if aux_info.groups <= 1 , critical_error: "filesystem size too small" is called.
* Yes, this is a bug in make_ext4fs.
* Fixing this issue for our device has two ways, one is switch to mke2fs as it works fine, second either revert the above changes from ext4_utils or fix code.
* According to report, mke2fs is upstream tool of make_ext4fs, and in future google will permanently switch to it. So better to use this on our device instead of putting hands on repo codes.
2019-02-27 18:50:08 +08:00

57 lines
1.2 KiB
Bash
Executable file

#!/bin/bash
OUT_PATH=""
BR_ROOT=`(cd ../../..; pwd)`
export PATH=$PATH:$BR_ROOT/target/tools/host/usr/bin
export PATH=$PATH:$BR_ROOT/output/external-toolchain/bin
# build adb
cd ${LICHEE_TOP_DIR}/buildroot/target/common/adb;
make
make install
if [ $? -ne 0 ]; then
exit 1
fi
# sysroot exist?
cd ${LICHEE_TOP_DIR}/buildroot/target/${LICHEE_PLATFORM};
if [ ! -d "./sysroot" ]; then
echo "extract sysroot.tar.gz"
tar zxf ../common/rootfs/sysroot.tar.gz
fi
if [ ! -d "./output/bin" ]; then
mkdir -p ./output/bin
fi
cd src
make
if [ $? -ne 0 ]; then
exit 1
fi
cd ..
if [ ! -d "rootfs/dragonboard" ]; then
mkdir -p rootfs/dragonboard
fi
cp -rf ${LICHEE_TOP_DIR}/buildroot/target/common/scripts/autorun.sh rootfs/
rm -rf rootfs/dragonboard/*
cp -rf output/* rootfs/dragonboard/
echo "generating rootfs..."
#NR_SIZE=`du -sm rootfs | awk '{print $1}'`
#NEW_NR_SIZE=$(((($NR_SIZE+32)/16)*16))
NEW_NR_SIZE=256
TARGET_IMAGE=rootfs.ext4
echo "blocks: $NR_SIZE"M" -> $NEW_NR_SIZE"M""
make_ext4fs -l $NEW_NR_SIZE"M" $TARGET_IMAGE rootfs/
fsck.ext4 -y $TARGET_IMAGE > /dev/null
echo "success in generating rootfs"
if [ -n "$OUT_PATH" ]; then
cp -v rootfs.ext4 $OUT_PATH/
fi
echo "Build at: `date`"