Dev - juanjoSanz/yi-hack GitHub Wiki

Development themas

  • Set dev environment
  • Create custom FW images
  • Add cross compiled code : sshd for example

home image / modify

Unpacking Xiaoyi Firmware Images http://irq5.io/2015/10/30/unpacking-xiaoyi-firmware-images/

Compile binaries for Yi Camera

# uname -a
Linux (none) 3.0.8 #1 Wed Apr 30 16:56:49 CST 2014 armv5tejl GNU/Linux

# cat /proc/cpuinfo 
Processor       : ARM926EJ-S rev 5 (v5l)
BogoMIPS        : 218.72
Features        : swp half thumb fastmult edsp java 
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 5
Hardware        : hi3518
Revision        : 0000
Serial          : 0000000000000000

How to compile binaries?

-march=armv5   ?
static build   ?

http://stackoverflow.com/questions/18548230/cross-compiling-for-arm-armv5tejl

http://nemon.org/ipcam-ipr1631x/#SDK

How to build new packages/tools:

Make sure that your system uses the /bin/bash as default shell – otherwise the install scripts will not work.

Download SDK (see bellow)
Extract SDK: tar xzf Hi3518_SDK_V1.0.7.0.tgz
Unpack SDK: cd Hi3518_SDK_V1.0.7.0 && ./sdk.unpack
Install Toolchain: cd osdrv/toolchain/arm-hisiv100nptl-linux && chmod +x cross.install && ./cross.install
Add Toolchain to PATH: echo "export PATH=/opt/hisi-linux-nptl/arm-hisiv100-linux/target/bin:\$PATH" >> ~/.bashrc
Reload .bashrc: source ~/.bashrc
Test for working cross compiler: cd ../../../mpp2/sample/ && make

Download:

SDK (V1.0.7.0)
Hi3518_SDK_V1.0.7.0.tgz (631 MBytes)

Hi3518_SDK_V1.x.x.x directory structure is as follows:
|-- sdk.cleanup    # SDK cleanup script
|-- sdk.unpack     # SDK expand the script
|-- osdrv          # store the operating system and associated drive directory
|   |-- busybox/busybox-1.16.1.tgz # busybox source tarball
|   |-- kernel/linux-3.0.y.tgz     # linux kernel source code
|   |-- uboot/u-boot-2010.06.tgz   # uboot source code
|   |-- toolchain/arm-*            # cross tool chain store directory
|   |-- tools/*                    # tools (source), such as mkfs.cramfs
|   `-- rootfs_scripts/rootfs.tgz  # root file system
|-- package        # store directory SDK various compression packages
|-- scripts        # store shell scripts directory
|-- mpp/mpp2       # stored media processing platform directory
    |-- component  # component source code
    |-- extdrv     # board-level peripheral driver source code
    |-- include    # external header files
    |-- ko         # kernel module
    |-- lib        # release version of the library and audio library
    |-- sample     # sample source code
    `-- tools      # media processing tools

Compile dropbear for armv5 (sshd)

(test 1) ./configure --host=arm-linux-gnueabi --prefix=/ --disable-zlib CC=arm-linux-gnueabi-gcc LD=arm-linux-gnueabi-ld

(test 2) ./configure --host=armv5tejl-linux-gnueabi --prefix=/ --disable-zlib CC=armv5tejl-linux-gnueabi-gcc LD=armv5tejl-linux-gnueabi-ld


make

Busybox

current version ( Hi Linux ) armv5 arch

# uname -a
Linux (none) 3.0.8 #1 Wed Apr 30 16:56:49 CST 2014 armv5tejl GNU/Linux
# /bin/busybox | head -1
BusyBox v1.16.1 (2012-10-22 16:45:54 CST) multi-call binary.

test -- binary https://busybox.net/downloads/binaries/

# ./busybox-armv5l  | head -1
BusyBox v1.26.2 (2017-01-10 16:10:07 GMT) multi-call binary.
# ./busybox-armv5l ls
Segmentation fault
# ./busybox-armv5l ls -l
Segmentation fault
# ./busybox-armv5l echo 
Segmentation fault

Segmentation fault --- why? (to-do)