Как стать автором
Обновить

Building firmware for Orange PI i96 (Orange PI 2g-iot) from scratch

Уровень сложностиПростой
Время на прочтение14 мин
Количество просмотров1.2K

Hellow my name is Dmitry. Once I bought "Orange PI i96", but unfortunately producer not update it firmvere very long. Last firmwere kernel version is 3.10.62 but kernel current at time this article writing (russian version) is 6.5.1. And so I decide build my own firmware from scratch, and do it from sourse completely.

At fist a want to noute that for assembly I use WSL (Windows Subsystem for Linux) and Ubutu for guest system. Everything went well but I have got some trobles (about they I will say below). Also I wante to note that during work I had to reinstall Windows? but I don't loosed my files. If WSL loose Linux image you cane restore it by command:

wsl --import-in-place <new_distro_name> <path_to_ext4.vhdx>

Important not lose ext4.vhdx file.

Сompilation U-boot.

At the first create working dir:

mkdir OrangePI
cd OrangePI

I will compile U-boot from i96 SDK? because it work well.

wget https://github.com/orangepi-xunlong/toolchain/archive/refs/heads/arm-linux-gnueabi-1.13.1.zip
unzip arm-linux-gnueabi-1.13.1.zip

Get toolchain. We will use it only for for compile u-boot:

wget https://github.com/orangepi-xunlong/OrangePiRDA_uboot/archive/refs/heads/master.zip
unzip master.zip
cd OrangePiRDA_uboot-master

Configuring and compile:

make CROSS_COMPILE=/home/dmitry/OrangePI/toolchain-arm-linux-gnueabi-1.13.1/gcc-linaro-1.13.1-2012.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- rda8810_config
make CROSS_COMPILE=/home/dmitry/OrangePI/toolchain-arm-linux-gnueabi-1.13.1/gcc-linaro-1.13.1-2012.02-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi- -j16

You'll have another path to toolchain, and number after j equall number yours CPU flows. During compilation I have got error (error while loading shared libraries: libz.so.1). I overcame it by command:

sudo apt-get install lib32z1

After compilation, in u-boot directory will appear file u-boot.rda. We will need it later.

Creating root directory.

Create directory rootfs, this is our root dir. For correct working it need some folders where will mount system dirs.

mkdir rootfs
cd rootfs
mkdir -p dev root sys proc run tmp var/run var/log

Kernel compilation.

At fist we have to choose toolchain. RDA8810PL use ARMv7 command set with hardware flow commans. I have choose gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.

wget https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/arm-linux-gnueabihf/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz
tar -xvf gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf.tar.xz

After that go to Kernel.org and get current kernel (kernel current at time this article writing (russian version) is 6.5.1).

wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.5.1.tar.xz
tar -xvf linux-6.5.1.tar.xz
cd linux-6.5.1

Orange PI i96 use RDA8810PL chip. But drivers for this chip missing in stock kernel. I have got necessary from i96 SDK. But this has one troble, this drivers create for old Linux achitecture without "device tree". So this I fixed drivers for device tree archetecture.

In old Linux versions. Kernel inicializate divice by itself. And because every single-board computer has different device set it need costom kernel. But now device set storet in external file device tree (.dts after compile .dtb).

For now get my repository and copy files from it to linux folder.

Creating configurations for kernel:

make ARCH=arm CROSS_COMPILE=/home/dmitry/OrangePI/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- defconfig
make ARCH=arm CROSS_COMPILE=/home/dmitry/OrangePI/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- menuconfig

Go to menu and set options:

  • System type --> RDA Micro SoCs

  • Device drivers --> Character devices --> Enable TTY --> Serial Drivers --> RDA Micro serial port support --> Console on RDA Micr serial port

  • Device drivers --> GPIO Support --> Memory Mapped GPIO drivers --> RDA Micro GPIO controller support

  • Device drivers-->RDA support (you need go inside "RDA support" and set all options)

When you try set "RdaMicro IEEE802.11 emdedded FullMac WLAN driver", you get messege that this option depends from another option witch set as module. For fix it you need set option:

Networking support --> Wireless --> cfg80211-wireless configuration API

As commone. After that set "RdaMicro IEEE802.11 emdedded FullMac WLAN driver" or Wi-Fi will not working.

make ARCH=arm CROSS_COMPILE=/home/dmitry/OrangePI/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -j16

Or you can compile kernel in parts:

make ARCH=arm CROSS_COMPILE=/home/dmitry/OrangePI/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -j16 zImage
make ARCH=arm CROSS_COMPILE=/home/dmitry/OrangePI/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -j16 dtbs
make ARCH=arm CROSS_COMPILE=/home/dmitry/OrangePI/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -j16 modules

If you use WSL and have coped driver by Windows Explorer you get error "access denied". Because all copied files has owner root. You need enter command:

sudo chown -R "your accaunt name":"your accaunt name" drivers/rda 

After compilation install kernel modules in rootfs directory:

make ARCH=arm CROSS_COMPILE=/home/dmitry/OrangePI/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=../rootfs

Also create folder "sysroot" where will stored headers files, which needs for compilation libraries and applications.

mkdir -p ../sysroot/usr
make ARCH=arm CROSS_COMPILE=/home/dmitry/OrangePI/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- INSTALL_HDR_PATH=../sysroot/usr headers_install

Merge Device tree file and kernel by command cat.

cat /home/dmitry/OrangePI/linux-6.5.1/arch/arm/boot/zImage /home/dmitry/OrangePI/linux-6.5.1/arch/arm/boot/dts/unisoc/rda8810pl-orangepi-i96.dtb > zImage+dtb

Compilation glibc

Glibc this is C standard library. Because every program on Linux write on C, nothing will work without it.

For cross compile you need set some environment variable:

export PATH=/home/dmitry/OrangePI/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin:$PATH
export CHOST=arm-linux-gnueabihf
export CC=arm-linux-gnueabihf-gcc
export AR=arm-linux-gnueabihf-ar
export CXX=arm-linux-gnueabihf-g++

So let's get started:

wget https://ftp.gnu.org/gnu/glibc/glibc-2.38.tar.gz
tar -xzf glibc-2.38.tar.gz
cd glibc-2.38
mkdir build
cd build
../configure --prefix=/usr --host=arm-linux-gnueabihf CFLAGS="--sysroot=/home/dmitry/OrangePI/sysroot -O2" CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar CXX=arm-linux-gnueabihf-g++
make CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar CXX=arm-linux-gnueabihf-g++ -j16
make DESTDIR=`pwd`/glibcBuild install

During compilation had appear two error:

fatal error: gmp.h: No such file or directory
fatal error: mpc.h: No such file or directory

Solution:

sudo apt-get install libgmp3-dev libmpfr-dev
sudo apt-get install libmpc-dev

Let's go to folder "glibcBuild" and sort files:

To "rootfs" folder:

etc
lib
sbin
usr/bin
usr/lib/*.so
usr/libexec
usr/sbin
usr/share

Further in the rootfs folder we will put *.so files, this is dynamic load libriarys. Files *.o static libraries which need only for compilation.

To sysroot folder:

lib
usr/include
usr/lib

To "sysroot" folder we will put everything.

Compilation BusyBox

Busybox this is light set of utility for embedded systems. It's the best fit for single-board computers.

wget https://busybox.net/downloads/busybox-1.36.1.tar.bz2
tar -xvjf busybox-1.36.1.tar.bz2
cd busybox-1.36.1
make CROSS_COMPILE=/home/dmitry/OrangePI/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- defconfig
make CROSS_COMPILE=/home/dmitry/OrangePI/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -j16

Busybox will install in folder _install. All contents we copy to rootfs.

Compilation libxcrypt.

wget https://github.com/besser82/libxcrypt/releases/download/v4.4.36/libxcrypt-4.4.36.tar.xz
tar -xvf libxcrypt-4.4.36.tar.xz
cd libxcrypt-4.4.36
mkdir build
./configure --prefix=/home/dmitry/OrangePI/libxcrypt-4.4.36/build --host=arm-linux-gnueabihf
make CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar CXX=arm-linux-gnueabihf-g++ -j16
make install

Contents folder build/lib/*.so to "rootfs", all the rest to "sysroot".

Compilation DropBear

Because Orange PI i96 haven't video output ports, only one way interact with it, through terminal. Therefore, we will install the DropBear ssh server.

wget https://matt.ucc.asn.au/dropbear/releases/dropbear-2022.83.tar.bz2
tar -xjf dropbear-2022.83.tar.bz2
cd dropbear-2022.83
./configure --prefix=/home/dmitry/OrangePI/rootfs --disable-zlib --host=arm-linux-gnueabihf CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-ld
make install

For DropBear to work correctly, you need to generate keys.

cd ../rootfs
mkdir etc/dropbear
dropbearkey -t dss -f etc/dropbear/dropbear_dss_host_key
dropbearkey -t rsa -f etc/dropbear/dropbear_rsa_host_key

Compilation libnl-3 libryary.

wget http://www.infradead.org/~tgr/libnl/files/libnl-3.2.25.tar.gz
tar -xzf libnl-3.2.25.tar.gz
cd libnl-3.2.25
mkdir build
./configure --host=arm-linux-gnueabihf --prefix=/home/dmitry/OrangePI/libnl-3.2.25/build
make -j16 CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar CXX=arm-linux-gnueabihf-g++ 
make install
cd include
make install

From build folder copy to "rootfs" all except include. All the rest copy to "sysroot".

Compilation iw

For use terminal we need network. "iw" this is utility fot wi-fi setting.

Before we start, we need set variable PKG_CONFIG_PATH and install pkg-config package.

export PKG_CONFIG_PATH=/home/dmitry/OrangePI/sysroot/lib/pkgconfig
sudo apt-get install -y pkg-config

Let's start:

wget https://www.kernel.org/pub/software/network/iw/iw-3.15.tar.gz
tar -xzf iw-3.15.tar.gz
cd iw-3.15
make -j16 CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar CXX=arm-linux-gnueabihf-g++
cp iw ../rootfs/sbin/

Compilation OpenSSL

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz
tar -xzf openssl-1.1.1h.tar.gz
cd openssl-1.1.1h
mkdir build
./Configure linux-generic32 --prefix=/home/dmitry/OrangePI/openssl-1.1.1h/build
make -j16 CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar CXX=arm-linux-gnueabihf-g++
make install

In rootfs copy lib\libcrypto.so and lib\libssl.so. Everything else copy in sysroot.

Compilation wpa_supplicant

With "iw" we can create connection only with not safe access point. If we want conect to safe access point we need "wpa_supplicant".

wget https://w1.fi/releases/wpa_supplicant-2.10.tar.gz
tar -xzf wpa_supplicant-2.10.tar.gz
cd wpa_supplicant-2.10/wpa_supplicant
cp defconfig .config

I had to make some changes to the .config file. At first I uncomment strings with OpenSSL folders:

CFLAGS += -I/home/dmitry/OrangePI/sysroot/include
CFLAGS += -I/home/dmitry/OrangePI/sysroot/include/libnl3
LIBS += -L/home/dmitry/OrangePI/sysroot/lib

And after that I comment this strings.

#CONFIG_DRIVER_MACSEC_LINUX=y
#CONFIG_MACSEC=y
#CONFIG_CTRL_IFACE_DBUS_INTRO=y
#CONFIG_CTRL_IFACE_DBUS_NEW=y

Compiling:

make CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar CXX=arm-linux-gnueabihf-g++ -j16
make install DESTDIR=/home/dmitry/OrangePI/rootfs

Creating configuration files.

Very impotant not use Windows notepad because Windows and Linux has different line ending characters. If you don't want use console you can use Notepad++. Just setting line ending characters in menu "Edit->EOL Conversion".

At first we create user "root" with "/" home folder. This mean when we enter to system we will see root folder.

cd rootfs/etc
cat >> passwd
root:x:0:0:root:/:/bin/sh
^D

^D means CTRL+D combination for end editing.

File "shadow" contains encrypted passwords. There is crypted password "root".

cat >> shadow
root:LlNBpbQmj8p7g:1:0:99999:7:::
^D

Creating "group" file. Group wheel need for wap-suplicant work.

cat >> group
root:x:0:root
wheel:x:10:root
^D

File wpa_supplicant.conf contains information about connecting network. It contain access point password as hex number. For create this password use wpa_passphrase:

wpa_passphrase i96 123456789

There is "i96" access point and password "123456789".

cat >> wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel
network={
       ssid="i96"
        psk=c96a7f97cfee8b9f9ce9aae88c4cc6c5f1962f6dca48ea7444d80a70a300b5b1
}
^D

File resolv.conf contains DNS servers IP.

cat >> resolv.conf 
nameserver 1.1.1.1
nameserver 1.0.0.1
^D

Let's add a few more files for the network configuration.

cat >> hosts
127.0.0.1	localhost
^D
cat >> hostname
OrangePI
^D
cat >> host.conf
order hosts, bind
multi on
^D
cat >> networks
loopback	127.0.0.0
localnet	127.0.0.0
^D

I add reference to some very big configuration files in end article.

The "profile" file contains the initial value of the PATH variable. This is useful, for example wap_suplicant is installed not in /usr/sbin but in /usr/local/sbin. I also added paths to the opt directory.

The system initialization scripts.

The inittab file is responsible for things like booting, shutting down, and pressing Alt Ctrl Del. Help.

cat >> inittab
::sysinit:/etc/rc.d/rc.S
::respawn:-/bin/sh -l
::ctrlaltdel:/sbin/reboot 
::shutdown:/etc/rc.d/rc.0
^D

Create scripts folder:

mkdir rc.d
cd rc.d

Scrypt rc.0 unmount disks during shutdown.

cat >> rc.0
#!/bin/sh
sync
/sbin/umount -a -r > /dev/null 2>&1
^D

Scrypt rc.S running during loading system:

Hidden text
#!/bin/sh
# Mount procfs. 
/bin/mount -v proc /proc -t proc 1> /dev/null

/bin/mkdir /dev/pts
/bin/mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts 

PATH=/bin:/usr/bin:/sbin:/usr/sbin
# We will hold temp folders in RAM.
/bin/mount -t tmpfs none -o size=150M,nodev,nosuid,noatime /tmp
/bin/mount -t tmpfs none -o size=10M,nodev,nosuid,noatime /var/log
/bin/mount -t tmpfs none -o size=5M,nodev,nosuid,noatime /var/run
/bin/mount -t tmpfs none -o size=5M,nodev,nosuid,noatime /run

# Delet old mount fs file and create new.
/bin/rm -f /etc/mtab{,~,.tmp} && /bin/touch /etc/mtab

# Mount sysfs and run ldconfig for update libryary information
/bin/mount -v sysfs /sys -t sysfs 1> /dev/null
if [ -x /sbin/ldconfig ]; then
  /sbin/ldconfig 1> /dev/null
fi

# Run system logger
/sbin/syslogd 2> /dev/null
sleep 1
/sbin/klogd -c 3 1> /dev/null

modprobe loop 1> /dev/null 2> /dev/null

if [ -x /etc/rc.d/rc.modules ]; then
. /etc/rc.d/rc.modules
fi

if [ -x /etc/rc.d/rc.network ]; then
. /etc/rc.d/rc.network start
fi

# Erase screen
/bin/setterm -blank 0 2>/dev/null


echo > /etc/motd
echo "`/bin/uname -a | /usr/bin/cut -d\  -f1,3`." >> /etc/motd
echo >> /etc/motd

# Console login prompt
echo "Press <Enter>..."

Network initialization script:

Hidden text
#!/bin/sh

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin

net_start() {
    
    ifconfig wlan0 up
	iw dev wlan0 scan > /dev/null 
	wpa_supplicant -B -D nl80211 -i wlan0 -c /etc/wpa_supplicant.conf
	sleep 2
	ifconfig lo up 127.0.0.1
    route add -net 127.0.0.0 netmask 255.255.255.0 lo
	ifconfig wlan0 192.168.1.252 netmask 255.255.255.0
	route add default gw 192.168.1.1 wlan0
	dropbear
	route 
}

net_stop() {
    if [ -f /var/run/udhcpc.pid ]; then
      kill -9 `cat /var/run/udhcpc.pid`
      rm /var/run/udhcpc.pid
    fi
    ip set link wlan0 down
}

case "$1" in
'start')
    net_start
    ;;
'stop')
    net_stop
    ;;
'restart')
    net_stop
    net_start
    ;;
*)
    echo "Usage $0 start|stop|restart"
esac

Scrypt scan acsses points and find those acsses points parameters of which are written in the wpa_supplicant.conf file. If you want connect to not secure access point you can change wap_suplicant line to iw dev wlan0 connect "not secure access point name". "iw dev wlan0 link" - get network interface information. "ifconfig -a" - get network interface list.

We need to clarify here. My scrypt always set self IP to 192.168.1.252 and connect to router with IP 192.168.1.1. But if you want system set IP itself you need change:

ifconfig wlan0 192.168.1.252 netmask 255.255.255.0
route add default gw 192.168.1.1 wlan0

to:

udhcpc -i wlan0 -p /var/run/udhcpc.pid -s /etc/scripts/udhcp.sh 

And add scrypt udhcp.sh

#!/bin/sh

ACTION="$1"

case "${ACTION}" in
"renew"|"bound")
    /sbin/ifconfig ${interface} ${ip} netmask ${subnet}
    /sbin/route del default > /dev/null 2>&1
    for i in "${router}"; do
        /sbin/route add default gw $i dev ${interface}
    done
    ;;
esac

Don't forget allow run scripts:

chmod u+x rc.0
chmod u+x rc.S
chmod u+x rc.network

Creating uInitrd file.

So that the system boot is considered successful. The kernel must had do two things. Mount root file system and run incialization script (with sucsses). But for mount root directory from SD card (for example) we need SD card driver. But for this we should already have root directory, for load drivers. For overcome this dilemma Linux have uInitrd image. This image mount in RAM before mount main root directory.

Interesting. If we put initialization script (init) in uInitrd.

#! /bin/sh
mount -t sysfs sysfs /sys
mount -t proc proc /proc
mount -t devtmpfs udev /dev
mkdir /dev/pts
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts 
/sbin/syslogd
sleep 1
/sbin/klogd -c 3
. /etc/rc.d/rc.network start
dropbear
sysctl -w kernel.printk="2 4 1 7"
/bin/sh
poweroff -f

Linux mount uInitrd, run script and stop. And we get Linux with root file system mount in RAM memory. Wich after restarting forgot all changes.

Lets start. At first archive the rootfs folder and then compress it by "gzip".

cd rootfs
find . | cpio -H newc -ov --owner root:root > ../initramfs.cpio
cd ..
gzip initramfs.cpio

Utilite mkimage add header necessary for u-boot.

mkimage -A arm -T ramdisk -n uInitrd -d initramfs.cpio.gz uInitrd

Creating boot.scr

"boot.scr" this is boot scrypt for u-boot.

Have create boot.cmd.

setenv bootargs "earlycon initcall_debug console=ttyRDA2,921600n8 root="/dev/mmcblk0p2" rootfstype="ext4" rootwait rw"
ext2load mmc 0:1 ${kernel_addr} zImage+dtb
ext2load mmc 0:1 ${script_addr} rda8810pl-orangepi-i96.dtb
ext2load mmc 0:1 ${initrd_addr} uInitrd
ext2load mmc 0:1 ${modem_addr} modem.bin
mdcom_loadm ${modem_addr}
mdcom_check 1
bootz ${kernel_addr} ${initrd_addr}:${filesize} ${script_addr}

And then compile it by mkimage:

mkimage -C none -A arm -T script -d boot.cmd boot.scr

File "modem.bin" this is firmware for embedded modem. Yes "i96" has modem which has own firmware. You can find "modem.bin" by reference in end.

Assembling image.

Well, actually all the preparations are over, it will be faster.

At first create header for image 2 megabyte size.

dd if=/dev/zero bs=1M count=2 of="NewImg.img"

Copy u-boot.rda to offset 256512 byte (one block equals 512 bytes by default). Why this offset? Because RDA chip transfert running program by 256512 byte offset after boot.

dd if=OrangePiRDA_uboot-master/u-boot.rda conv=notrunc seek=256 of="NewImg.img"

Creating boot folder 50 megabyte size. And root folder 300 megabyte size.

dd if=/dev/zero bs=1M count=50 of="NewImg.img"1
dd if=/dev/zero bs=1M count=300 of="NewImg.img"2

Creating file systems for this folders:

mkfs.ext2 -L BOOT "NewImg.img"1
mkfs.ext4 -O ^metadata_csum -F -b 4096 -E stride=2,stripe-width=1024 -L rootfs "NewImg.img"2

Mount boot folder and copy necessary files.

mkdir -p /tmp/tmp
sudo mount "NewImg.img"1 /tmp/tmp
sudo cp -rf linux-6.5.1/zImage+dtb /tmp/tmp
sudo cp -rf linux-6.5.1/arch/arm/boot/dts/unisoc/rda8810pl-orangepi-i96.dtb /tmp/tmp
sudo cp -rf uInitrd /tmp/tmp
sudo cp -rf boot.cmd /tmp/tmp
sudo cp -rf boot.scr /tmp/tmp
sync
sudo umount /tmp/tmp

Mount root folder and copy rootfs directory to it:

sudo mount "NewImg.img"2 /tmp/tmp
sudo cp -rT rootfs /tmp/tmp
sync
sudo umount /tmp/tmp

Merge all parts to one:

dd if="NewImg.img"1 conv=notrunc oflag=append bs=1M seek=2 of="NewImg.img"
dd if="NewImg.img"2 conv=notrunc oflag=append bs=1M seek=52 of="NewImg.img"

Create partition table.

For now image not working because it has not partition table. Partition table create by "fdisk":

fdisk "NewImg.img"
o
n
p
1
4096
+50M

n
p
2
106496

w

After start set command "o" for crate new MBR table. Create new part by "n", Set fist partition number and type. And then fist sector number. One sector equale 512 byts one kilobyt 2 sectors. We had header by 2 Megobyte size, from this fist sector number 4096. And then set size 50 megobyts. Similarly for root partition.

Partition table we can see by command:

sudo parted NewImg.img unit s print

Also we can mount one of partition by command:

sudo mount -o loop,offset=2097152 NewImg.img /tmp/tmp 
sudo mount -o loop,offset=54525952 NewImg.img /tmp/tmp

All that remains is to write the image to an SD card, for example using Win32DiskImager (if you use Windows).

Fist run.

You need crate acsses point "i96" with paasword "123456789", and router IP set as 192.168.1.1. (Network settings configurate in file /etc/wpa_supplicant.conf and IP configurate in file /etc/rc.d/rc.network.). Login root password root.

If you want get additional applications for Orange Pi you can install Entware. Forum page.

Go to "root" folder and download install script:

cd /root
wget http://bin.entware.net/armv7sf-k3.2/installer/generic.sh
chmod u+x generic.sh
./generic.sh

After this we get root directory in folder opt. Also we get package manager "opkg".

For example install sftp-server:

opkg update
opkg install openssh-sftp-server

We have some troubles. Because we compile DropBear from source trying to search sftp-server in /usr/libexec/sftp-server folder but it contain in /opt/lib/sftp-server. We need create symbolic link:

ln -s /opt/lib/sftp-server /usr/libexec/sftp-server

Thats all.

About camera.

As you know Orange PI i96 has camera SCI port. And I also had try connect camera. But I had find two troubles.

  • Power supply voltage is 2.9V (Pin10) but it should be 1.8.

  • SCI interface has i2c inside for control camera, this is SCK and SDA (Pin 3 and Pin 5). And SDA pin always has 0V. But all pins i2c must pull up to suply voltage. From this I think SCI port has tracing error. And camera cann't work.

Links:

My repository with drivers for kernel.

Files modem.bin, profile, protocols, services, termcap.

Building image for Orange PI i96 (it must work on Orange PI 2g-iot, but I can't check)

Files from Orange PI i96 SDK. I compared SDK kernel and origin 3.10.62 kernel, and this is files exist only in SDK.

По-русски пожалуйста.

Теги:
Хабы:
Всего голосов 6: ↑4 и ↓2+5
Комментарии6

Публикации

Истории

Ближайшие события

7 – 8 ноября
Конференция byteoilgas_conf 2024
МоскваОнлайн
7 – 8 ноября
Конференция «Матемаркетинг»
МоскваОнлайн
15 – 16 ноября
IT-конференция Merge Skolkovo
Москва
22 – 24 ноября
Хакатон «AgroCode Hack Genetics'24»
Онлайн
28 ноября
Конференция «TechRec: ITHR CAMPUS»
МоскваОнлайн
25 – 26 апреля
IT-конференция Merge Tatarstan 2025
Казань