export WORKSPACE_TOP_DIR=${WORKSPACE_TOP_DIR:=$HOME/workspace}
export PLATFORM_TOP_DIR=${PLATFORM_TOP_DIR:=$WORKSPACE_TOP_DIR/platform}
export ANDROID_TOP_DIR=${ANDROID_TOP_DIR:=$PLATFORM_TOP_DIR}
export KERNEL_TOP_DIR=${KERNEL_TOP_DIR:=$WORKSPACE_TOP_DIR/kernel}
export BRANCH=mirror-aosp-android-hikey-linaro-4.14
export KERNEL_SRC=$KERNEL_TOP_DIR/out/$BRANCH/hikey-linaro
export KERNEL_DIST_DIR=$KERNEL_TOP_DIR/out/$BRANCH/dist
export KBUILD_OBJ=$KERNEL_TOP_DIR/out/$BRANCH/hikey-linaro
export UWBCORE_TOP_DIR=${UWBCORE_TOP_DIR:=$WORKSPACE_TOP_DIR/uwb-core}
mkdir -p ${WORKSPACE_TOP_DIR}/platform
cd $PLATFORM_TOP_DIR
repo init -u https://android.googlesource.com/platform/manifest
repo sync -j$(nproc)
mkdir -p ${WORKSPACE_TOP_DIR}/kernel
cd $KERNEL_TOP_DIR
repo init -u https://android.googlesource.com/kernel/manifest -b android-hikey-linaro-4.14
repo sync -j$(nproc)
cd $PLATFORM_TOP_DIR
wget https://dl.google.com/dl/android/aosp/hisilicon-hikey960-OPR-3c243263.tgz
tar -xf hisilicon-hikey960-OPR-3c243263.tgz
extract-hisilicon-hikey960.sh
cd ${PLATFORM_TOP_DIR}
. ./build/envsetup.sh
lunch hikey960-userdebug
make -j$(nproc)
On Hikey960 Switch to fastboot mode, switch 3 to on
fastboot flash boot out/target/product/hikey960/boot.img
fastboot flash dts out/target/product/hikey960/dt.img
fastboot flash system out/target/product/hikey960/system.img
fastboot flash vendor out/target/product/hikey960/vendor.img
fastboot flash userdata out/target/product/hikey960/userdata.img
Switch off fast bootmode, switch 3 to off
Modify the device tree with the LSI HiKey Connector board configuration.
- Use porting/dpl/kernel/hikey960_dts.patch to update dts and dtsi files in ./arm64/boot/dts/hisilicon/
cd $KERNEL_TOP_DIR/hikey-linaro
git apply $KERNEL_TOP_DIR/modules/uwbcore/porting/dpl/kernel/hikey960_dts.patch
cd ${KERNEL_TOP_DIR}
echo 'CONFIG_UIO=y' >> $KERNEL_TOP_DIR/hikey-linaro/arch/configs/hikey960_defconfig
cd ${KERNEL_TOP_DIR}
rm build.config
ln -s hikey-linaro/build.config.hikey960.clang build.config
cd ${KERNEL_TOP_DIR}
build/build.sh
cp -v $KERNEL_DIST_DIR/hi3660-hikey960.dtb ${PLATFORM_TOP_DIR}/device/linaro/hikey-kernel/hi3660-hikey960.dtb-4.14
cp -v $KERNEL_DIST_DIR/Image.gz-dtb ${PLATFORM_TOP_DIR}/device/linaro/hikey-kernel/Image.gz-dtb-hikey960-4.14
cd ${PLATFORM_TOP_DIR}
make bootimage -j$(nproc) TARGET_KERNEL_USE=4.14
${KERNEL_TOP_DIR}/hikey-linaro/mkdtimg -d ${PLATFORM_TOP_DIR}/device/linaro/hikey-kernel/hi3660-hikey960.dtb-4.14 -s 2048 -c -o $PLATFORM_TOP_DIR/out/target/product/hikey960/dt.img
Note: Using the S3 switch on Hikey is a little more reliable than using adb reboot bootloader command
adb reboot bootloader
fastboot flash boot $PLATFORM_TOP_DIR/out/target/product/hikey960/boot.img
fastboot flash dts $PLATFORM_TOP_DIR/out/target/product/hikey960/dt.img
fastboot reboot
Below are the steps insert dw1000-sensor module during booting, below mentioned steps needs to be followed.
- Add below mentioned line in device/linaro/hikey/hikey960/BoardConfig.mk to enable permissions to load module automatically.
- BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
- Add below mentioned line in system/core/rootdir/init.rc in "on post-fs" section to insert module.
- insmod /data/dw1000-sensor.ko
-
Re-build and flash AOSP images (system.img,vendor.img).
-
Push dw1000-sensor.ko in /data folder using adb.
- sudo adb push dw1000-sensor.ko /data
- Restart the Hikey960.
Note: If SPI driver is modified then repeat steps (4), (5).
cd ${WORKSPACE_TOP_DIR}
git clone [email protected]:Decawave/uwb-core.git
cd ${WORKSPACE_TOP_DIR}/uwb-core
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -f Makefile.kernel
cd ${WORKSPACE_TOP_DIR}/uwb-core
adb wait-for-device
adb push ./porting/dpl/kernel/uwb_hal/uwb-hal.ko /data/local/tmp
adb push ./uwbcore.ko /data/local/tmp
adb push ./lib/uwb_listener/uwb_listener.ko /data/local/tmp
adb wait-for-device
adb root
adb shell
insmod /data/local/tmp/uwb-hal.ko
insmod /data/local/tmp/uwbcore.ko
insmod /data/local/tmp/uwb_listener.ko
make -f Makefile.cmake arm64
make -C build_arm64
adb push $UWBCORE_TOP_DIR/build_arm64/apps/twr_aloha/TWR_ALOHA /data/local/tmp
adb shell
su
insmod /data/local/tmp/uwb-hal.ko
/data/local/tmp/TWR_ALOHA
adb shell
su
echo 1 > /sys/kernel/uwbcore/uwbccp/role
echo 1 > /sys/kernel/uwbcore/uwbccp/enable
cat /dev/uwbccp