• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoLinux DistributionsBuild Archlinux Image for pcDuino (II)
Previous Next

Build Archlinux Image for pcDuino (II)

Posted by: admin , January 3, 2014

[vc_row][vc_column][vc_column_text]We have built the basic archlinux image for pcDuino in http://learn.linksprite.com/?p=1222. Now we will fully build the archlinux system.

archlinux

[/vc_column_text][vc_tour][vc_tab title=”Improve archlinux build” tab_id=”1388722707-1-62″][vc_column_text]pcDuino now boots from basic archlinux.  The following work will be done on that pcDuino.

After pcDuino boots, it asks for username and password. The initial username is ‘root’. Password is also ‘root’. The pcDuino should connect to internet using the Ethernet port.

1. Update system

$pacman -Syyu

2. Create regular user account

$useradd -m -s /bin/bash archlinux

3. Set password

$passwd archlinux

4. Install sudo so that regular users can execute as root:

$pacman –S sudo

5. Add the privilege of running sudo to the regular users:

Run $visudo,  and edit:

##

## User privilege specification

##

root ALL=(ALL) ALL

archlinux ALL=(ALL) ALL

We can save and exit by pressing : , and then x.

2014-01-02 21.35.26

6.  Add dynamic driver module to system:

$nano /etc/modules-load.d/modules.conf

Add the following content:

lcd

hdmi

ump

disp

disp_ump

mali

mali_drm

8192cu

rt5370sta

2014-01-02 21.55.54

After it’s done, save and reboot:

$sudo reboot

After it rebooted, now we can check if the drive is loaded:

[archlinux@alarm ~]$ lsmod

Module                  Size  Used by

8192cu                536896  0

mali_drm                2087  0

drm                   156908  1 mali_drm

mali                   91146  0

disp_ump                 823  0

ump                    43846  2 mali,disp_ump

7. Install openssh, so that we can remotely connect:

$pacman  -S  openssh

$systemctl enable sshd  #let system automatically launch  openssh after start

Next, we use command ‘ifconfig’ to find out the IP address of pcDuino.

[/vc_column_text][/vc_tab][vc_tab title=”Install display driver” tab_id=”1388722707-2-97″][vc_column_text]After the steps in previous section, now our system is pretty complete. We can use tools as putty to connect to pcDuino. But still the system is in command line mode, and there is no desktop GUI.  In this section, we are going to install desktop GUI to pcDuino. As some intermediate steps are too complicated, we will skip these for now, and use the pre-configured files. We will come back to these later. You can download the pre-configured files from github.

1. Install make toolchain:

$pacman  -S  gcc make

2. Install Desktop:

$pacman -S xorg-server xorg-server-utils xorg-xinit

$pacman  -S  xfce4

Please just press ENTER to install all.

3. Add privileges to drivers

$cd  /etc/udev/rules.d/

$sudo nano 50-mali.rules

and add the following content:

KERNEL==”mali”, MODE=”0660″, GROUP=”video”

KERNEL==”ump”, MODE=”0660″, GROUP=”video”

4. Install dependency files:

$sudo pacman -S automake autoconf

$sudo pacman -S libdri2

$sudo pacman -S pkg-config

$sudo pacman -S xorg-util-macros libtool xorg-server-devel pyxdg

$sudo pacman -S xorg-server xorg-server-utils xorg-xinit

$sudo pacman -S dri2proto git

5. Install libdri2

$git clone https://github.com/robclark/libdri2

$cd libdri2

$./ autogen .sh

$sudo make  install

6、 Install GPU driver sunxi-mali

$git clone https://github.com/linux-sunxi/sunxi-mali.git

$cd sunxi-mali

$git submodule init

$git submodule update

$sudo make install

If during install process, there is error, we need to add the following two lines to Makefile.config:

$nano Makefile.config:
we add the following content:
25    else ifeq ($(dumpmachine),armv7l-unknown-linux-gnueabihf) #archlinux HF
26      ABI = armhf

7. Install xf86-video-sunxifb

$git clone  https://github.com/Pillar1989/xf86-video-mali   #This is the code we made, we will come back to this later

$cd sf86-video-mali

$sudo make install

8. Fix the issue where desktop installed in the path of previous step cannot load

$cd xf86-video-mali

$sudo  cp src/.libs/mali_drv.so  /usr/lib/xorg/modules/dri/

$cd  /

Now we find where do we download libdri2:

$find / -name libdri2

and change to that directory.

$sudo cp  src/.libs/*    /usr/lib/xorg/modules/dri/

The src directory above is under libdri2.

$cd  /usr/lib/xorg/modules/dri/

$sudo  ln -s  libdri2.so.1.0.0 libdri2.so.1

9. Copy xorg.conf to/etc/X11.

The file xorg.conf can be download from here, please unpack it.

We can copy it to a USB flash drive, and insert the flash drive to pcDuino.

Use ‘$fdisk -l’ to find out where the USB flash drive is loaded.  In our case, it is ‘/dev/sda1’.

We move forward to mount it:

$sudo      mount /dev/sda1 /mnt

$sudo cp /mnt/xorg.conf /etc/X11/.

10.  Test the desktop

$startxfce4

IMG_4834

[/vc_column_text][/vc_tab][vc_tab title=”Configure Desktop” tab_id=”1388808954097-2-9″][vc_column_text]

1. Copy the scripts that can be used to configure the desktop

$cd   xf86-video-mali

$sudo  cp set_window.sh /usr/bin/

$sudo cp  setwindow  /usr/bin/

2. If the desktop doesn’t display correctly, offset, or too big, too small, we can run:

$setwindow 100 1 0 0

2014-01-03 21.17.46

[/vc_column_text][/vc_tab][vc_tab title=”Install Arduino style SDK” tab_id=”1388809346241-3-0″][vc_column_text]

Use command  ‘$uname –a’ to check the version of Kernel. If it is:

Linux alarm 3.4.29+ #1 PREEMPT Sun Nov 3 11:00:11 CST 2013 armv7l GNU/LinuxThat means the kernel version is still  3.4.29+, we can directly copy over the hardwarelib from Lbuntu of pcDuino to the corresponding location of archlinux.

We then need to add the following information to ‘/etc/modules-load.d/modules.conf’:

hdmi

ump

disp

disp_ump

mali

mali_drm

8192cu

sw_interrupt

gpio

pwm

adc

[/vc_column_text][/vc_tab][vc_tab title=”Configure xfce4 to launch during startup” tab_id=”1388809588792-4-8″][vc_column_text]The log in management has the following options:

XDM: X display management  (xorg-xdm)

GDM: GNOME display management  (gdm)

KDM: KDE display management  (kdebase-workspace)

SLiM: Simple login management  (slim)

LXDM: LXDE display management  (independent of the desktop) (lxdm)

Qingy: getty   (qingy)

wdm: WINGs (wdm)

CDM: control console(available in the AUR: cdm-git)

LightDM: the replacement of GDM

where  slim and lightdm are light weight, and has a small flash footprint.

There are three types of desktop, openbox (light weight), xfce4 and gnome.

Configure the desktop to automatically load:

$sudo  pacman -S slim

$sudo  systemctl enable slim.service

$nano ~/archlinux/.xinitrc  # this is for username archlinux, we need also add this for ~/root/.xinitrc , which is for user root.

#!/bin/sh

#

# ~/.xinitrc

#

# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then

for f in /etc/X11/xinit/xinitrc.d/*; do

[ -x "$f" ] && . ”$f”

done

unset f

fi

# exec gnome-session

# exec startkde

exec startxfce4

# …or the Window Manager of your choice

[/vc_column_text][/vc_tab][vc_tab title=”Install web browser” tab_id=”1388814278693-5-0″][vc_column_text]

Now we install a web browser:

$pacman -S chromium chromium-pepper-flash

[/vc_column_text][/vc_tab][vc_tab title=”Clean Up System” tab_id=”1388814342304-6-9″][vc_column_text]

$sudo pacman -Scc

$sudo pacman –Sc

[root@alarm archlinux]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/nandd      1.8G  1.4G  269M  85% /

none            406M     0  406M   0% /dev

devtmpfs        406M     0  406M   0% /dev

tmpfs           407M     0  407M   0% /dev/shm

tmpfs           407M  1.4M  406M   1% /run

tmpfs           407M     0  407M   0% /sys/fs/cgroup

tmpfs           407M  8.0K  407M   1% /tmp

[/vc_column_text][/vc_tab][vc_tab title=”Release Image” tab_id=”1388815067450-7-2″][vc_column_text]

Insert SD card and mount:

$sudo   mount /dev/ mmcblk0p1 /mnt

$sudo  cd /mnt

$sudo  dd if=/dev/nandd of=archlinux.img  bs=1M

[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]

Tags: Linux Distributions

Share!
Tweet

admin

About the author

One Response to “Build Archlinux Image for pcDuino (II)”

  1. Log in to Reply
    Nicolas
    October 21, 2014 at 12:19 am

    The part for modules doesn’t works.

    After reboot, I’ve got :

    systemd-modules-load[4220]: Failed to lookup alias ‘ump’: Function not implemented
    systemd-modules-load[4220]: Failed to lookup alias ‘disp’: Function not implemented
    systemd-modules-load[4220]: Failed to lookup alias ‘disp_ump’: Function not implemented
    systemd-modules-load[4220]: Failed to lookup alias ‘mali’: Function not implemented
    systemd-modules-load[4220]: Failed to lookup alias ‘mali_drm’: Function not implemented
    systemd-modules-load[4220]: Failed to lookup alias ‘8192cu’: Function not implemented
    systemd-modules-load[4220]: Failed to lookup alias ‘rt5370sta’: Function not implemented

    In the “systemctl start systemd-modules-load.service”.

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors