Quanzhi Allwinner A20 set-top box is flushed into Native Debian

Source: Internet
Author: User
Tags spl

Quanzhi Allwinner A20 set-top box is flushed into Native Debian

Spent 60 oceans to purchase a tianmin TV genie 3 Android set-top box. The purpose of the purchase is to refresh the native Debian or other release versions.

View the specific hardware: quanzhi Allwinner A20 dual-core CPU, Cortex-A7 architecture; Memory 1G; flash 4G; Two USB, one HDMI, one AV. After reading the Sunxi Wiki, we found that we can use the following methods to refresh it. It is best to have a ttl line to access the UART interface of the box to view the output information.

The procedure is as follows:

Part 1:

Go to the default Android system, and use the ttl to directly mount the nanda partition with the root account to obtain the script. bin. If you do not have a ttl line, you can try to connect the adb to the box first, then use the root master to obtain the root permission, and then perform the operations in sequence: First connect the box to Wifi, thenadb connect IPADDRESS, Root. In short, it is to get script. bin.

Method for getting script. bin:

# mkdir /sdcard/nanda# mount -t vfat /dev/block/nanda /sdcard/nanda# exit# adb pull /sdcard/nanda/script.bin

After obtaining script. bin, if you want to modify the node, you need sunxi-tools:

# git clone https://github.com/linux-sunxi/sunxi-tools# make./bin2fex script.bin script.fex

Edit the fex file and then regenerate the binary file:

./fex2bin script.fex script.bin

The script. bin file is the binary implementation of the fex file. The fex file defines how the SoC works. It configures the GPIO pin and sets parameters such as DRAM and display (such as HDMI, VGA, and resolution.

Part 2:

1. Compile uboot

The compiling environment here is Linux version 3.16.0-4-686-pae (debian-kernel@lists.debian.org) (gcc version 4.8.4 (Debian 4.8.4-1) #1 SMP Debian 3.16.7-ckt11-1 + deb8u3 ), the default compilation tool is gcc-arm-linux-gnueabihf, which can be found in the "deb http://emdebian.org/tools/debian/ jessie main" source.

Because I cannot find the uboot source code of the box, I tried to use the uboot source code of cubieboard2, which can be used normally after compilation.

git clone https://github.com/linux-sunxi/u-boot-sunxi -b wip/a20make cubieboard2 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

Find an SD card for guidance. The SD card is used for guidance by default. Fdisk is used to divide SD into two areas. The first is fat and the second is ext4. According to my sdb1 and sdb2.

Write compiled uboot into sdcard:

# dd if=spl/sunxi-spl.bin of=/dev/sdb bs=1024 seek=8# dd if=u-boot.bin of=/dev/sdb bs=1024 seek=32

Create a new boot. cmd file and enter the following content:

setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwaitpanic=10 ${extra}fatload mmc 0 0x48000000 uImagebootm 0x48000000

Use the cmd file to generate the scr file:

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

2. Compile the kernel

I still use the cubieboard2 kernel because I cannot start it after compiling with the Sunxi kernel. I have been a newbie for a few days. You can directly use the cubieboard2 kernel to start it, but you need to add the phy nic Driver of the box. The PHY of tianmin TV genie 3 is an ICplus chip. Follow these steps:

# git clone https://github.com/cubieboard2/linux-sunxi# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

Enter the menuconfig status and add ICplus Nic support:

# make -j$(nproc) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=output modules_install

The generated kernel and module path:

arch/arm/boot/uImageoutput/lib/

Create Debian rootfs:

# debootstrap --verbose --arch=armhf --foreign jessie debian http://ftp.cn.debian.org/debian# cd debian# cp /usr/bin/qemu-arm-static usr/bin/# LC_ALL=C LANGUAGE=C LANG=C chroot . /debootstrap/debootstrap --second-stage# LC_ALL=C LANGUAGE=C LANG=C chroot . dpkg --configure -a

Chroot and deploy rootfs:

passwdecho "a20" > etc/hostnameecho "127.0.0.1 a20" >> etc/hostnameecho T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> etc/inittabecho deb http://ftp.cn.debian.org/debian/ jessie main contrib non-free > etc/apt/sources.listecho deb http://security.debian.org/ jessie/updates main contrib non-free >> etc/apt/sources.listapt-get updateapt-get dist-upgradeapt-get install openssh-serverapt-get install localesecho "en_US.UTF-8 UTF-8" > etc/locale.genecho "zh_CN.UTF-8 UTF-8" >> etc/locale.genlocale-gen

You need to modify the two files/etc/network/interfaces and/etc/ssh/sshd_config under rootfs to enable static ip addresses and support root logon.

After all the preparation is complete, copy the file to the corresponding partition of the SD card:

Copy the file to sdb1:

UImage script. bin boot. scr

Then copy the Debian rootfs file to sdb2 and the kernel module to/lib.

Insert the SD card into the box. Wait for a moment before you can log on to the box using ssh. A complete native Debian system is running.

At present, we have learned that using/dev/fb0 should be able to continue to start Xorg, and running LXDE should be fine.

Current problem: Two USB interfaces on the box cannot be used! Because it is the source code and uboot of cubieboard2 applied, whether it is script. bin or the source code, I have been tossing for a few days and still cannot make it. I hope you can help me solve this problem. Thank you!

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.