blog ~ coding for fun . how to install lubuntu on cubietruckmarkus.tizara.de/docs/arm/how to install...

13
01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #1 home blog forum projects about BLOG BLOG ~ coding for fun . ~ coding for fun . How to install Lubuntu on Cubietruck May 25, 2014 This is how to install and set-up the latest Lubuntu software pack on to the NAND Flash on the Cubietruck from a Mac OS X computer. Cubietruck The Cubietruck is a 5V 2A single-board computer "SBC" / PC on Board "PCB" – much like the Raspberry Pi that has taken the World with a craze - but the Cubietruck is just faster, better and stronger.. In realty Cubietruck is more like a real Mini PC. The Cubietruck is based on the dual core Cortex-A7 (912MHz each) ARM Allwinner CPU with 2 GB Ram. Cubietruck has 8 GB onboard bootable NAND flash memory and it is expandable with a micro sdcard up to 32GB. You can connect a monitor/TV via the VGA or HDMI interface. The Cubietruck comes equipped with both Wifi and Bluetooth, Gigabit Ethernet, 2 USB 2.0, 1 Micro USB, OTG, SPDIF, IR, and Headphone. You can easily add a and fit a 2.5 inch Hard Disk Drive to the Cubietruck out the box. PowerDC5V @ 2.5A with HDD and support Li-battery & Real Time Clock “RTC”. The Cubitruck was released for sale on the 31th. of October 2013 from http://cubieboard.org. Supported Operative Systems: Android Fedora Lubuntu Lbuntu Server BTW: I look forward to an Arch Linux distro for Cubietruck ( you can check here:)! The Cubietruck comes with Android preinstalled on the NAND – and it works out the box. Cubietruck looks after a bootable OS on the Micro SDcard before it boots from the NAND flash memory. There are 3 different ways to install and run Lubuntu on the Cubietruck: . 1 NAND flash

Upload: others

Post on 23-Sep-2019

9 views

Category:

Documents


0 download

TRANSCRIPT

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #1

home blog forum projects aboutBLOGBLOG ~ coding for fun .~ coding for fun .How to install Lubuntuon CubietruckMay 25, 2014

This is how to install and set-up the latest Lubuntu software pack on to the NAND Flash on the Cubietruckfrom a Mac OS X computer.

Cubietruck

The Cubietruck is a 5V 2A single-board computer "SBC" / PC on Board "PCB" – much like the Raspberry Pithat has taken the World with a craze - but the Cubietruck is just faster, better and stronger.. In realtyCubietruck is more like a real Mini PC.

The Cubietruck is based on the dual core Cortex-A7 (912MHz each) ARM Allwinner CPU with 2 GB Ram.Cubietruck has 8 GB onboard bootable NAND flash memory and it is expandable with a micro sdcard upto 32GB. You can connect a monitor/TV via the VGA or HDMI interface. The Cubietruck comes equippedwith both Wifi and Bluetooth, Gigabit Ethernet, 2 USB 2.0, 1 Micro USB, OTG, SPDIF, IR, and Headphone.You can easily add a and fit a 2.5 inch Hard Disk Drive to the Cubietruck out the box. Power�DC5V @ 2.5Awith HDD and support Li-battery & Real Time Clock “RTC”.

The Cubitruck was released for sale on the 31th. of October 2013 from http://cubieboard.org.

Supported Operative Systems:

AndroidFedoraLubuntuLbuntu Server

BTW: I look forward to an Arch Linux distro for Cubietruck ( you can check here:)!

The Cubietruck comes with Android preinstalled on the NAND – and it works out the box. Cubietrucklooks after a bootable OS on the Micro SDcard before it boots from the NAND flash memory.

There are 3 different ways to install and run Lubuntu on the Cubietruck:

. 1 NAND flash

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #2

. 2 Micro SD card

. 3 2.5 HHD / SSD ( or a 3.5 HHD with an external power supply )

InstallYou need this in advance:

A Mac running a newer version of OS X with access to the Internet. I am doing this from aMacBook Pro Retina running OS X version 10.9 Mavericks.An assembled Cubietruck with incl. cables with 2.5 HHDUSB Power supply 5v 2/2.5A.An ethernet Internet connection.

NAND Installation

Get the software

Download and install the LiveSuit NAND installer in your app folder: LiveSuit_ForMac.zip

Download the latest Lubuntu NAND image for Cubietruck: Cubietruck Lubuntu Desktop Releases orA20-Cubietruck Lubuntu Server Releases

Connect the mini USB to your mac (mac only).

Open LiveSuit and Select the downloaded Lubuntu NAND image (.img)

Enter FEL Mode

. 1 Press FEL key and hold it in

. 2 Plug in mini usb cable to the Cubietruck and wait for the prompt

. 3 Release FEL key

Flash to Board

When you see the prompt, you have entered FEL mode. Select Yes to continue.

That’s it!

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #3

Moving Rootfs From Nandflash To Hard Drive

Prepeare the drive for rootfs

Th drive must have a primary partition formated with filesystem ext4 . You can use the Linaro userinterface DISK app, gparted or use the following shell commands to partition your HDD.

List all available drives:

Choose the drive you want to make changes to (e.g. sda):

Use p (print partition of a drive), d deletea partition or n (create new partition). The partitionshould be of type 83 .

Format the partition for rootfs with EXT4 filesystem:

Copying Rootfs

Assuming that /dev/sda is the hard drive we want to install.

Changing Boot Parameters

Change the contents of uEnv.txt from nand_root=/dev/nandb tonand_root=/dev/sda1 . And check the changes with cat command.

Unmount the partition.

# fdisk -l

# fdisk /dev/sda

# mkfs.ext4 /dev/sda1

$ sudo su - root# mkdir -p /tmp/nandb# mount /dev/nandb /tmp/nandb# (cd /tmp/nandb; tar --backup -c *) | tar -C /data -xv

$ sudo su - root# mkdir -p /tmp/nanda# mount /dev/nanda /tmp/nanda

# vim /tmp/nanda/uEnv.txtconsole=tty0extraargs=console=ttyS0,115200 hdmi.audio=EDID:0 disp.screen0_output_mode=EDID:1280

nand_root=/dev/nandb

# cat /tmp/nanda/uEnv.txt

# umount /tmp/nanda

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #4

Flush the file system buffers with sync.

That’s it!

ConfigurationInstall tools and change default setting

Locale

Network

Set Time Zone/DateTime

Set time zone

Select the Asia , press Enter and choose China ,at last selet Beijing.

Copy file to /etc directory

Update time

# sync# reboot

sudo passwd rootsudo usermod -l nick linaro

$sudo apt-get update$sudo apt-get upgradesudo apt-get install -y bash-completion vim tmuxsudo apt-get install -y build-essential make gcc g++ git-core x11vnc

locale-gen en_US.UTF-8dpkg-reconfigure localesecho "export LC_ALL=en_US.UTF-8" >> /etc/profile

echo "auto eth0:1" >> /etc/network/interfacesecho "iface eth0:1 inet static" >> /etc/network/interfacesecho "address 192.168.2.123" >> /etc/network/interfacesecho "netmask 255.255.255.0" >> /etc/network/interfaces

sudo tzselect

sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

$sudo ntpdate time.windows.com

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #5

VNC

Set keyboard language

To be defined ….

Flashplayer

Download the flashplayerarm,type:

Wi-Fi

CB1 and CB2 do not integraed wifi chip on board ,but we can use USB WIFI. Make sure the wifi driver youuse have been loaded. If not ,use

CB3(cubietruck) has Integrated wifi chip .

Type : modprobe bcmdhd to load the driver .

Add bcmdhd at the end of file /etc/modules to activate WiFi during boot. For example withLubuntu Desktop:

Reboot the cubieboard .

Configure wifi at cubieboards and cubietruck the same way as descibed her:

Add below configuration to /etc/network/interfaces

vi /etc/init/x11vnc.conf

start on login-session-startscript x11vnc -display :0 -auth /var/run/lightdm/root/:0 -forever -bg -rfbport 5900end script

reboot

$tar zxvf flashplayerarm.tar.gz $sudo cp libpepflashplayer.so /usr/lib/chromium-browser/plugins$sudo cp default /etc/chromium-browser

$insmod /lib/modules/3.4.XX/kernel/drivers/net/wireless/XXX.ko

#echo bcmdhd >> /etc/modules

#apt-get install linux-firmware#reboot

$ifconfig wlan0 up //open the wifi ,maybe wlan1 ..$iwlist wlan0 scan //scan the wifi signal$wpa_passphrase SSID passwd >> /etc/wpa_supplicant.conf // the SSid is name of signal want to be used

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #6

Add below configuration to /etc/resolv.conf

Restart networking service,auto gain the IP.

AP Mode

�� Cubietruck ���� AP ������������

�������� hostapd ��� IEEE 802.11 AP � IEEE 802.1X/WPA/WPA2/EAP/RADIUS ���)

��������������� hostapd �������� ��������������,�������

������������� hostapd ����� /usr/sbin ��

���� hostapd ������� /etc/hostapd/hostapd.conf ��

������: ���http://wireless.kernel.org/en/users/Documentation/hostapd

$vim /etc/network/interfaces

auto wlan0iface wlan0 inet dhcpwpa-conf /etc/wpa_supplicant.conf

nameserver 8.8.8.8

$sudo /etc/init.d/networking restart

$ifconfig

wlan0 Link encap:Ethernet HWaddr 98:3b:16:1e:65:62 inet addr:192.168.1.111 Bcast:255.255.255.255 Mask:255.255.255.0 inet6 addr: fe80::9a3b:16ff:fe1e:6562/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:367 errors:0 dropped:0 overruns:0 frame:0 TX packets:129 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:28505 (28.5 KB) TX bytes:20113 (20.1 KB)

# modprobe bcmdhd op_mode=2

interface=wlan0driver=nl80211ssid=__cubietruck__channel=1hw_mode=gmacaddr_acl=0auth_algs=1ignore_broadcast_ssid=0wpa=2wpa_passphrase=12345678wpa_key_mgmt=WPA-PSKwpa_pairwise=TKIPrsn_pairwise=CCMP

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #7

����������

���� channel ������������ channel �����������

. 1 �����contended����������������� channel ������������������������������

. 2 �����interfering�� ��������������� channel��� channel 6� ��������� channel 6 ������������ 5 � channel�����channel 4 ~ channel 8�20MHz � channel ���� ����������� channel6 ��channel 4 ~ channel 8����� channel 7 ��channel 5 ~ channel 9�� ����������������������������������������������

���������������������������� channel��� channel 6��������� 40MHz � channel ������������������������������channel 6 ���������� channel������channel 11 ��������� channel��� channel11 �� channel 1 �������������������� 40MHz � channel �������������� WiFi ������ 40MHz ������� 7 � channel������������������������������������

��������������� wpa2����� wep ����������� wpa � wpa2���������� wpa2� ������������������������������

����� /etc/rc.local �������������� WiFi�

������������ SSID � cubietruckcubietruck � AP�������� 12345678 ����� ������ Cubietruck ������������WiFi ������������������������ Cubietruck � WiFi ��������������

. 1 ������ IP ��

. 2 ��

��������������� bridge-utils�

�� /etc/network/interfaces �

��� eth0 � wlan0 ������Cubietruck ������ IP 192.168.1.150������������������������������������ IP�

���������� hostapd ����� /etc/hostapd/hostapd.conf�������

hostapd -B /etc/hostapd/hostapd.conf

# apt-get install bridge-utils

# loopbackauto loiface lo inet loopback

# bridgeiface eth0 inet manualiface wlan0 inet manualauto br0iface br0 inet static bridge_ports eth0 wlan0 address 192.168.1.150 netmask 255.255.255.0 gateway 192.168.1.1

auto br0iface br0 inet dhcpbridge_ports eth0 wlan0

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #8

����� Cubietruck � WiFi �������

Setting CPU Frequency

Cubieboard CPU frequency can be adjusted in real time, , the following file save as shell file, or placed in/etc/rc.local before the exit 0 can be executed. Specific CPU frequency maximum and

minimum values can be set based on usage .

After testing, Cubieboard single core version (A10) CPU frequency can be overclocked to 1.2 GHz, stableoperation (would be better to stick a CPU heatsink); Cubieboard dual-core version (A20) can also beoverclocked to 1.2GHz

NAND

�������� nandflash �

��� nand ����� nandflash�nanda�nandb�nandc ��� 3 �������

nanda ��� bootlogo�script.bin�uEnv.txt �nandb �� rootfsnandc � 5G ������

�������� nandb �������������� nand-part �������������������

����������������������������

���������

bridge=br0

#!/bin/shecho ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governorecho 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freqecho 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freqecho 25 > /sys/devices/system/cpu/cpufreq/ondemand/up_thresholdecho 10 > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor

$ ls /dev/nand* -lbrw-rw---- 1 root disk 93, 0 Jan 1 2010 /dev/nandbrw-rw---- 1 root disk 93, 1 Jan 1 2010 /dev/nandabrw-rw---- 1 root disk 93, 2 Jan 1 2010 /dev/nandbbrw-rw---- 1 root disk 93, 3 Jan 1 2010 /dev/nandc

partition 1: class = DISK, name = bootloader, partition start = 32768, partition size = 131072 user_type=0partition 2: class = DISK, name = rootfs, partition start = 163840, partition size = 4194304 user_type=0partition 3: class = DISK, name = UDISK, partition start = 4358144, partition size = 10584064 user_type=0

# nand-part -f a20 /dev/nand 32768 'bootloader 131072' 'rootfs 14778368'

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #9

���� bootloader �nanda����������rootfs�nandb�� UDISK�nandc�����4194304 + 10584064 =14778368��

�������������������� nandb ����

�������������������������

Developing

Using serial debug port

The tutorial how to use TTL cable: http://linux-sunxi.org/Cubieboard/TTL

Install the tool name minicom in your computer:

Set the minicom configuratiaon, TTL and cubieboard are connected ,then minicomin the terminal ,enterinto the console.

Installing target Toolchains

Hardware Testing

The best way to test hardware is install the office firmware from http://dl.cubieboard.org and usr officefitting from http://docs.cubieboard.org/addons�which can find the problem quickly you met. Of course,you should save the data before reinstall firmware.

LEDs On Cubieboaed

These are blue LED1 meaning heartbeat and green LED2 on cb1 and cb2. LED1 - GPIO port PH21, LED2 -GPIO port PH20. These are LED1~4 on cb3(cubietruck). LED1 - PH21, LED2 - PH20,LED3 - PH11,LED4 -PH07.Refer to FAQ about cubietruck For cb1 and cb2:

The directories /sys/class/gpio/gpio1_PH20 and/sys/class/gpio/gpio2_PH21 had been create .

ready to write new partition tables:mbr: version 0x00000200, magic softw4112 partitionspartition 1: class = DISK, name = bootloader, partition start = 32768, partition size = 131072 user_type=0partition 2: class = DISK, name = rootfs, partition start = 163840, partition size = 14778368 user_type=0

# resize2fs /dev/nandb

$sudo apt-get install minicom

$sudo apt-get install vim build-essential git libusb-1.0-0-dev pkg-config -y

$echo 1 > /sys/class/gpio/export //open the PH20$echo 2 > /sys/class/gpio/export //open the PH21

$cd /sys/class/gpio/gpio1_PH20$echo out > direction //set PH20 as output$echo 1 > value //set PH20 as high ,grenn LED is light$echo 0 > value //set PH20 as low,turn off the LED

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #10

Turn off led.

HDMI

It would be best way connect the HDMI cable before power on the cubieboard,becuse some cable maybeappear the promble of sequence in time. If your have not full screen display, you can try the followingcommands

1.If you are using lubuntu, try the following commands

If you switch to other resolution, you need to restart your X after the modification

2.The default display configuration in script.bin of uboot partition of official desktop-firmware as :

ls /sys/class/leds/*/brightness | xargs -i -n1 echo "echo 0 > {}" | sh

$fbset -left 10

$wget http://dl.cubieboard.org/software/tools/armhf/cb-display-tool$chmod 777 cb-display-tool$cb-display-tool -o 8 -m 11 //switch to VGA type$cb-display-tool -o 4 -m 4 //switch to HDMI type

;disp init configuration;;disp_mode (0:screen0<screen0,fb0> 1:screen1<screen1,fb0> 2:two_diff_screen_diff_contents<screen0,screen1,fb0,fb1>; 3:two_same_screen_diff_contets<screen0,screen1,fb0> 4:two_diff_screen_same_contents<screen0,screen1,fb0>);screenx_output_type (0:none; 1:lcd; 2:tv; 3:hdmi; 4:vga);screenx_output_mode (used for tv/hdmi output, 0:480i 1:576i 2:480;screenx_output_mode (used for vga output, 0:1680*1050 1:1440*900 2:1360*768 3:1280*1024 4:1024*768 5:800*600 6:640*480 10:1920*1080 11:1280*720);fbx format (4:RGB655 5:RGB565 6:RGB556 7:ARGB1555 8:RGBA5551 9:RGB888 10:ARGB8888 12:ARGB4444);fbx pixel sequence (0:ARGB 1:BGRA 2:ABGR 3:RGBA) --- 0 for linux, 2 for android;lcd0_bright (lcd0 init bright,the range:[0,256],default:197;lcd1_bright (lcd1 init bright,the range:[0,256],default:197

[disp_init]disp_init_enable = 1disp_mode = 0screen0_output_type = 3screen0_output_mode = 4screen1_output_type = 0screen1_output_mode = 4fb0_width = 1024fb0_height = 768fb0_framebuffer_num = 2fb0_format = 10fb0_pixel_sequence = 0fb0_scaler_mode_enable = 0fb1_width = 1024fb1_height = 768fb1_framebuffer_num = 2fb1_format = 10fb1_pixel_sequence = 0fb1_scaler_mode_enable = 0

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #11

Modify the parameter according to the using HDMI displayer . You can get more information aboutdisplay from Display and modify script.bin from editthesystem_configuration

VGA

Refer to HDMI section.

USB Host

The quickly way to test the interface of USB is plug the U disk . The system will identify the U disk .Usefdisk -l can see its information which meaning the interface of USB is working.

IR

IR had beed add into the kernel .If not, use command to load the moudle:

Press the key of IR remote control,the terminal will print the message as:

The digital 0094 is keycode of the remote control .

Headphone Jack

There are two audio devices HDMI and headphone in the cubieboard.

There are two audio devices named sunxi-sndhdmi and sunxi-CODEC in the system. The sound output issend out from HDMI by default . You can adjust volume and other configuration ,use Ctrl-Z to saveit.

$insmod /lib/modules/3.4.X/kernel/drivers/input/keyboard/sun4i-ir.ko$sudo cat /dev/input/event0 | hexdump

0000000 8415 525f 50cf 0003 0001 0094 0001 00000000010 8415 525f 50db 0003 0000 0000 0000 00000000020 8415 525f 22f7 0007 0001 0094 0000 00000000030 8415 525f 22ff 0007 0000 0000 0000 0000

$sudo alsamixer

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #12

To set sound care being sunxi-CODEC modify /etc/asound.conf to turn on the headphone.

If Plug in the headphone and type:

The sound "sound left�sound right�sound left" will output from headphone.

Let cubieboard speak by package named espeak :

Camera

Most of the camera driver has integrated in the kernel�so it is available insert usb-camera into thecubieboard.

pcm.!default { type hw card 0 //If you want to set HDMI as output ,turn 0 to 1. device 0}ctl.!default { type hw card 0 //If you want to set HDMI as output ,turn 0 to 1.}

$speaker-test -twav -c2

$sudo apt-get install espeak$espeak "hello"�� //say: hello$espeak "hello cubieboard"��//say: hello cubieboard

01/16/15 http://blog.lsong.org/2014/05/lubuntu-on-cubietruck.html #13

References:Cubieforum for Q&A’s LUbuntu website .LiveSuit Guide cubieboard.org Tutorials for Cubietruck cubieboard.orgFAQ specs and faq’s cubieboard.orgA20-Cubietruck specs from SUNXICubieboard3: Cubietruck is all ready with links software etc.Moving Rootfs From Nandflash To Hard Drive cubieboard.org

comments powered by Disqus© 2014 LSONG.ORG

$sudo apt-get install luvcview$luvcview -s 1080x720 (can modify the resolution)