Other OS

[HOWTO] Installation and configuration

20 29343
Post Last Edited by muf at 2014-8-9 12:23

### To make this image I follow the instructions in the lemaker's wiki.

## http://wiki.lemaker.org/index.ph ... he_bootable_SD_card
## Partitioning and formatting
  1. sudo fdisk /dev/mmcblk0
Copy the Code

  1. Command (m for help): o
  2. Created a new DOS disklabel with disk identifier 0x1ee7d44d.
Copy the Code

  1. Command (m for help): n

  2. Partition type:
  3.    p   primary (0 primary, 0 extended, 4 free)
  4.    e   extended
  5. Select (default p):

  6. Using default response p.
  7. Partition number (1-4, default 1):
  8. First sector (2048-15523839, default 2048):
  9. Last sector, +sectors or +size{K,M,G,T,P} (2048-15523839, default 15523839): +20M

  10. Created a new partition 1 of type 'Linux' and of size 20 MiB.
Copy the Code

  1. Command (m for help): n

  2. Partition type:
  3.    p   primary (1 primary, 0 extended, 3 free)
  4.    e   extended
  5. Select (default p):

  6. Using default response p.
  7. Partition number (2-4, default 2):
  8. First sector (43008-15523839, default 43008):
  9. Last sector, +sectors or +size{K,M,G,T,P} (43008-15523839, default 15523839):

  10. Created a new partition 2 of type 'Linux' and of size 7.4 GiB.
Copy the Code

  1. Command (m for help): w
  2. The partition table has been altered.
  3. Calling ioctl() to re-read partition table.
  4. Syncing disks.
Copy the Code

  1. sudo mkfs.vfat /dev/mmcblk0p1
  2. sudo mkfs.ext4 /dev/mmcblk0p2
Copy the Code
## http://wiki.lemaker.org/index.php?title=Building_u-boot,_script.bin_and_linux-kernel
## Building u-boot, script.bin and linux-kernel

## toolchain for debian wheezy

  1. echo "deb http://www.emdebian.org/debian/ unstable main" >> /etc/apt/sources.list
  2. apt-get install emdebian-archive-keyring
  3. apt-get update
Copy the Code

  1. apt-get install gcc-4.7-arm-linux-gnueabihf build-essential pkg-config git debootstrap u-boot-tools libusb-1.0-0 libusb-1.0-0-dev git wget fakeroot kernel-package zlib1g-dev libncurses5-dev
Copy the Code

  1. ln -s /usr/bin/arm-linux-gnueabihf-gcc-4.7 /usr/bin/arm-linux-gnueabihf-gcc
Copy the Code
## u-boot

  1. git clone https://github.com/LeMaker/u-boot-bananapi.git
  2. cd u-boot-bananapi
  3. make CROSS_COMPILE=arm-linux-gnueabihf- Bananapi_config
  4. make CROSS_COMPILE=arm-linux-gnueabihf-
  5. cd ..
Copy the Code
## script.bin

  1. git clone https://github.com/LeMaker/sunxi-tools.git
  2. git clone https://github.com/LeMaker/sunxi-boards.git
  3. cd sunxi-tools
  4. make
  5. cd ../sunxi-boards
Copy the Code
# You can modify the "sys_config/a20/Bananapi.fex" file, like you can change led setting from "heartbeat" to "default-on" if you want.
# modify "fb0_framebuffer_num = 3" and add "sunxi_fb_mem_reserve = 32" in [disp_init] section.

  1. ../sunxi-tools/fex2bin sys_config/a20/Bananapi.fex script.bin
  2. cd ..
Copy the Code
## linux kernel

  1. git clone https://github.com/LeMaker/linux-bananapi.git
  2. cd linux-bananapi
  3. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig
Copy the Code
# add some useful drivers like USB WiFi, etc ... Attention for some drivers change the Bananapi.fex too.

  1. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
  2. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules
  3. make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=output modules_install
  4. cd ..
Copy the Code
## Bootloader

  1. sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1k count=1023 seek=1
  2. sudo dd if=u-boot-bananapi/u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1024 seek=8
Copy the Code
## Boot Script
  1. sudo mount /dev/mmcblk0p1 /mnt
Copy the Code
# adapt the resolution in the file for your screen : disp.screen0_output_mode=EDID:1280x1024p75

  1. cat > /mnt/uEnv.txt <<EOF
  2. bootargs=console=ttyS0,115200 disp.screen0_output_mode=EDID:1280x1024p75 hdmi.audio=EDID:0 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
  3. aload_script=fatload mmc 0 0x43000000 script.bin;
  4. aload_kernel=fatload mmc 0 0x48000000 uImage;bootm 0x48000000;
  5. uenvcmd=run aload_script aload_kernel
  6. EOF
Copy the Code
## Install Kernel

  1. sudo cp -f sunxi-boards/script.bin /mnt
  2. sudo cp -f linux-bananapi/arch/arm/boot/uImage /mnt
Copy the Code
## http://wiki.lemaker.org/index.ph ... on_root_file_system
## Setting up the Linux distribution root file system

  1. sudo umount /mnt
  2. sudo mount /dev/mmcblk0p2 /mnt
Copy the Code
## Using an existing rootfs tarball

  1. wget http://archlinuxarm.org/os/ArchLinuxARM-sun7i-latest.tar.gz
  2. sudo tar xzf ArchLinuxARM-sun7i-latest.tar.gz -C /mnt
Copy the Code
## Install Kernel modules

  1. sudo rm -fr /mnt/lib/firmware/
  2. sudo cp -fr linux-bananapi/output/lib/firmware /mnt/lib
  3. sudo rm -fr /mnt/lib/modules/
  4. sudo cp -fr linux-bananapi/output/lib/modules /mnt/lib
Copy the Code

  1. sync
  2. sudo umount /mnt
Copy the Code
## http://qdosmsq.dunbar-it.co.uk/b ... n-the-raspberry-pi/
## http://elinux.org/ArchLinux_Install_Guide
## Archlinux system configuration

## Set the hostname

  1. echo "BPi" > /etc/hostname
Copy the Code
## Change the Root Password

  1. passwd
Copy the Code
## Set your keymap (adapt for your country)
  1. cat > /etc/vconsole.conf <<EOF
  2. KEYMAP="fr-latin9"
  3. FONT="lat9w-16"
  4. EOF
Copy the Code
## Enable your locale
  1. cat > /etc/locale.gen <<EOF
  2. en_US.UTF-8 UTF-8  
  3. fr_FR.UTF-8 UTF-8  
  4. fr_FR ISO-8859-1  
  5. fr_FR@euro ISO-8859-15  
  6. EOF
  7. locale-gen
  8. echo -n "LANG=en_US.UTF-8\nLC_COLLATE=C" >> /etc/locale.conf
Copy the Code
## Clean up service unnecessary for a Pi
  1. systemctl disable haveged.service
  2. systemctl disable netctl-ifplugd@eth0.service
  3. rm -f /usr/lib/systemd/system/multi-user.target.wants/shadow.timer
  4. rm -f /usr/lib/systemd/system/multi-user.target.wants/logrotate.timer
  5. rm -f /usr/lib/systemd/system/multi-user.target.wants/man-db.timer
  6. systemctl enable dhcpcd.service
  7. systemctl enable ntpd
Copy the Code
## load modules for mali drivers
  1. cat > /etc/modules-load.d/mali.conf <<EOF
  2. ump
  3. disp_ump
  4. mali
  5. mali_drm
  6. sunxi_cedar_mod
  7. EOF
Copy the Code
##Enable this just for debugging
# Have boot messages stay on tty1
  1. #mkdir /etc/systemd/system/getty@tty1.service.d/
  2. #cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf <<EOF
  3. #[Service]
  4. #TTYVTDisallocate=no
  5. #EOF
Copy the Code
## Set your timezone
  1. rm -f /etc/localtime
  2. ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
Copy the Code
## Mount sata with "noauto" option. With "automount" there is a bug at boot.
  1. echo "/dev/sda1      /home   ext4    defaults,noatime,noauto        0       0" >> /etc/fstab
Copy the Code
## Pacman configuration
# enable the mirror of your country
  1. /etc/pacman.d/mirrorlist
Copy the Code
# add "linux-sun7i linux-firmware uboot-cubieboard2" to "IgnorePkg" option
  1. /etc/pacman.conf       
Copy the Code
## Update system
  1. systemctl start haveged.service
  2. pacman-key --init
  3. systemctl stop haveged.service
  4. pacman -Syu
Copy the Code
## Add user
  1. echo "muf:x:1000:100:,,,:/home/muf:/bin/bash" >> /etec/passwd
  2. passwd muf
  3. mkdir /home/muf
  4. chown -R muf.users /home/muf/
  5. usermod -a -G audio,games,power,storage,video muf
Copy the Code
## Install sudo
  1. pacman -S sudo
  2. echo "muf ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
Copy the Code
## install some packages
  1. pacman -S ethtool vim bash-completion git make gcc
Copy the Code
## install X
  1. pacman -S xorg-server xorg-utils xorg-server-utils xorg-xinit xterm xf86-video-fbturbo-git openbox alsa-utils mplayer
Copy the Code
## openbox configuration
  1. echo "exec openbox-session" > ~/.xinitrc
  2. mkdir -p ~/.config/openbox
  3. cp -R /etc/xdg/openbox/* ~/.config/openbox
Copy the Code
## keyboard fr for X
# in "/etc/X11/xorg.conf.d/10-keyboard-layout.conf" add :
  1. Option "XkbLayout"  "fr"
  2. Option "XkbVariant" "latin9"
Copy the Code
# if not work
  1. echo "setxkbmap -layout fr -variant nodeadkeys" > /home/muf/.config/openbox/autostart
Copy the Code
## libvdpau for sunxi
  1. git clone https://github.com/linux-sunxi/libvdpau-sunxi
  2. cd libvdpau-sunxi
  3. make && make install
Copy the Code
## set good permission
  1. cat > /etc/udev/rules.d/50-mali.rules <<EOF
  2. KERNEL=="mali", MODE="0660", GROUP="video"
  3. KERNEL=="ump", MODE="0660", GROUP="video"
  4. KERNEL=="g2d", MODE="0660", GROUP="video"
  5. KERNEL=="cedar_dev", MODE="0660", GROUP="video"
  6. KERNEL=="disp", MODE="0660", GROUP="video"
  7. EOF
Copy the Code
  1. reboot
Copy the Code
## For test movie in 1080 HD
  1. mplayer -vo vdpau -vc ffmpeg12vdpau,ffh264vdpau /home/video/movie.mkv
Copy the Code
Thanks muf for sharing!


I was with your guide, however I get the next error (in "make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules". I stay default config in the previous step, menuconfig):

include/linux/netdevice.h:29:28: error fatal: linux/if_ether.h: the file or folder doesn't exist
Finished compilation
make[1]: *** [init/do_mounts.o] Error 1
make: *** [init] Error 2

Do you know how solve it?

Thanks for all.

Post Last Edited by muf at 2014-8-8 02:29

add mali GPU driver
Thanks to nnn2.

Hi Muf

Thank you for your cross-compile howto. It works perfectly, and generates an Armv7 image, unlike the Armv6 Arch1.1 image.

However the ethernet does not work at all, giving a dmesg line: eth%d: device MAC address 02:41:0a:82:91:81

The "eth%d" comes from a C format string parameter passed to function alloc_netdev_mqs on line 375 of linux-bananapi/net/ethernet/eth.c

Has anyone else encountered this bug?

Reply 2# tony_zhang

Can you create Armv7 image, unlike the Armv6 Arch1.1 image with Mali GPU drivers as Arch1.1.1 please ?

Reply  tony_zhang

Can you create Armv7 image, unlike the Armv6 Arch1.1 image with Mali GPU drivers ...
mamiko Posted at 2014-8-11 01:56

    I mean Arch1.2, since Arch1.1.1 is already out.

Post Last Edited by muf at 2014-8-11 09:22

Reply 5# tidge

My network works. But sometimes my ethernet device speed is 100Mo/s so i force it to 1Go/s

Your device is detected ?
  1. ip a
  2. ethtool "dev"
Copy the Code

Reply 6# mamiko

We have beginning do it now. But now we encounter the problem that can not change the passwd. We use the latest Archlinux for sun7i

Is there any chance that this setup will be the default for newly suplied arch images?

You have to log in before you can reply Login | Sign Up

Points Rules