Running Linux on a tablet with SoC Allwinner A10 on board
Prehistory
I bought myself a tablet on the SoC Allwinner A10 ( sun4i is the code name of the AllWinner A10 processor ARMv7-A of the Cortex family of architecture core A8 ). At first I played with it on Android 2.x and then at 4.x, but over time, this was not enough for me. Yes, they began to produce minicomputers based on this SoC with Linux on board. I thought, “Hmm, why is my tablet worse?” And took up the business. As it turned out, everything was already done for me, and I didn’t have to do anything :
It remains only the whole thing is configured and assembled.
Wednesday
System - ArchLinux x86-64. Where to find and how to install the environment for the assembly will not describe, on the Internet, and so enough of this information. Yes, and most of this is not why, I will put everything you need collected. I have the following “kitchen”:
qemu-user-static — in order to be able to chroot in rootfs, it wasn’t in turnips, I had to get from the debian repository and build my package. The whole thing is necessary to run arm elf executables on a machine with a different architecture, in this case mine.
gcc version 4.6.1 ( Sourcery CodeBench Lite 2011.09-70) - GCC ARM Crosscompiler. Maybe the old one, but it does not let me down yet. I also advise you to put a linaro cross-compiler straight from the tin.
brom (looking for a bootloader in mmc, nand, usb called boot0 (the SPL - Second Program Loader: sun4i-spl.bin).
boot0 (the SPL - Second Program Loader: sun4i-spl.bin) initializes devices
SPL (boot0) boots u-boot (boot1)
U-boot (boot1) initializes the remaining devices and creates abstractions for working with hardware.
It loads the hardware configuration file (script.bin. Evb.bin, mele.bin sys_config.bin) next to the u-boot, similar to the initrd.
The u-boot boots the kernel.
Those. The download starts from the SD card, if there is no bootloader, it continues with NAND Flash. According to the documentation for the allwinner-uboot bootloader, the structure of the SD card should look like this:
Start
the size
description
0
8KB
Unused, available for partition table etc.
eight
24KB
Initial SPL loader
32
512KB
u-boot
544
128KB
environment
672
352KB
reserved
1024
Free for partitions
Build u-boot
It is not necessary to collect, sun4i-spl.bin u-boot.bin can be downloaded here .
We collect uboot-allwinner:
git clone git://github.com/hno/uboot-allwinner cd uboot-allwinner make sun4i CROSS_COMPILE=arm-none-linux-gnueabi- cd ..
Bootloader entry
Caution, be careful not to confuse the SD card device with other media.If you do not understand what you are doing, then do not do it. $ {SD} is a device variable, can be replaced manually, you can register before execution:
Attention, as a result of the operation, data on MicroSD drives will be lost, save everything you need in a safe place.
We need to create two sections necessarily.
The first section is a section with an iron configuration file (evb.bin) and a kernel (uImage). It should start with sector 2048, be 32MB-100MB in size and have a FAT file system (FAT partition type) or ext2 / 3 (partition type 83).
The second partition is the rootfs partition, the entire system itself, the partition size is preferably within 1GB-4GB, the file system is strictly ext4, the partition type is 83.
You can make another swap section, if desired.
Use the remaining space for yourself. I created a section for my data, you can mount it in / home /
Here is how I broke my 16GB card:
fdisk -l /dev/sdb Disk /dev/sdb: 15.9 GB, 15935209472 bytes 64 heads, 32 sectors/track, 15197 cylinders, 31123456 Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000728ca - Id /dev/sdb1 2048 34815 16384 83 Linux /dev/sdb2 34816 6326271 3145728 83 Linux /dev/sdb3 6326272 31123455 12398592 83 Linux
According to the points described above, we split the MicroSD drive. I hope those who use linux can use fdisk.
mkdir /mnt/sun4i-boot mkdir /mnt/sun4i-rootfs mount ${SD}1 /mnt/sun4i-boot mount ${SD}2 /mnt/sun4i-rootfs
Kernel build
The kernel can not be compiled, I have attached the finished kernel with modules from below.
# git clone git://github.com/amery/linux-allwinner.git # cd linux-allwinner make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- sun4i_defconfig # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- gconfig
Instead of gconfig, you can use xconfig (qt interface) or menuconfig (console interface). Do not forget to include the necessary drivers in the kernel as well as the features you need. Read hints to the parameters. I advise you not to forget about the modules of the touchscreen and FS (fat, ntfs).
The -j argument specifies the number of concurrent compilation threads. It has been empirically established that there should be one more threads than the cores in the processor. Optimization flags are taken from the ValdikSS article . Frankly, the kernel compiled with them. But I have not installed it on the SD flash card yet.
Install rootfs
I will not describe the initial rootfs how to load with the help of debootstrap , since it is worthy of another article. I'd rather butt ready Debian Wheezy ARMHF rootfs, and you use. Rootfs must be unpacked with the attributes saved to the second SD partition, since this is the way the u-boot is configured by default (you can read about the configuration here . Download Debian Wheezy Rootfs and unpack:
tar -xpf debian-wheezy-armhf-rootfs.img.tar.bz2 -C /mnt/sun4i-boot
By the way, there are modules for the 3.0.36+ kernel. There is also a lxde, slim autoloading user user, network-manager, nm-applet starts at the start of the session. Touchscreen works in touchpad mode. It is likely that all the necessary modules will load udev, but to be sure, they can be written into / mnt / sun4i-rootfs / etc / modules. The list of required modules can be obtained in AndroidOS via TerminalEmulator:
TerminalEmulator: $ lsmod
either through ADB:
adb shell lsmod
Linux boot setup
Download the archive with the contents of the first boot partition. And extract the evb.bin configuration file in / mnt / sun4i-boot from the archive.
tar -xf debian-wheezy-armhf-boot.tar.bz2 evb.bin -C /mnt/sun4i-boot
If you did not compile the kernel, then the assembled kernel 3.0.36+ can also be extracted:
tar -xf debian-wheezy-armhf-boot.tar.bz2 uImage -C /mnt/sun4i-boot
Launch
All, perhaps, is ready. We installed the system on an SD drive. Insert the microSD card into the card reader and turn it on. After 5 seconds after switching on, the backlight should light up, the screen will remain black. After a few minutes, the entire system should boot up. Remember, the default password is root - root, user - user.I advise you to change them. If you do not have a usb keyboard, then a virtual keyboard is pre-installed in the rootfs. Connect to a wifi network, or use a USB Ethernet adapter and connect to the network using nm-applet. Immediately you can connect via ssh. Launch lxterminal and deliver the necessary software.
sudo -i apt-get update apt-get install vlc geany
Possible problems
If you don’t see anything after switching on, it’s still possible loading, wait about 5 minutes. But if even the backlight isn’t, then you will need to replace evb.bin with your configuration file from the android firmware that is on nanda. On an Android device via Terminal Emaulator or via adb:
adb shell su mkdir /local/data/tmp/nanda mount /dev/block/nanda /local/data/tmp/nanda
Extracting any ways script.bin, I did this: $ adb pull /local/data/tmp/nanda/script.bin evb.bin
cp evb.bin /mnt/sun4i-boot/
If there is still a backlight, but the system has not booted, you can view the system logs, remove the microSD card from the tablet and mount it in / mnt / sun4i-rootfs
If the touch does not work, then you need to find out in Android which module is responsible for your touch: Method via ADB:
adb shell 'lsmod | grep ts'
Method via TerminalEmulator
and prescribe it / mnt / sun4i-rootfs / etc / modules.
Conclusion
So I launched linux on my MOMO9 tablet. The system is not yet fully configured, it would not hurt to configure the same laptop-mode and deliver the necessary packages. Time was spent is not enough. But then, having assembled the system “almost” from scratch, you immediately begin to understand how this OS works. The vocabulary of special English vocabulary is also being replenished, which is not bad either.
Debian Wheezy on MOMO9 screenshots
Here is a screenshot taken on the device itself using the import utility from the MagickImage package. Filmed on the camera phone, the other was not at hand, so sorry.
And of course, I do not bear any responsibility for what you do on your PC for damage to the equipment.Do everything with an understanding of the case.Do not confuse an SD reader device with a hard drive or other device.
The .config file can be retrieved from an already compiled kernel using a script located in the kernel source folder linux-allwinner / scripts / extract-ikconfig. I mean that you can not configure the new kernel yourself from scratch, but use the configuration file from the old kernel, only when compiling, you will be asked to build a script that you can do with the new features and modules of the kernel (turn on the kernel or not include the kernels).
RZK333 added sources: Rhombus-Tech channel # arm-netbook @ freenode, where actually all the authors of what you describe (patches for the kernel, patches for u-boot, parsing SPL, loading from SD) and linux-sunxi.org where everything was folded. The channel was not, but on the wiki information is interesting.
I do not pretend to the most correct method of installation, perhaps, I do not understand some things that way, since I only recently began to study this sphere. Therefore, I ask you, if you notice some inaccuracies, do not “hesitate” to correct me. I will only be grateful to you.