jeancf post at 2015-12-16 05:50:56

Setting up arch + mainline kernel on Orange Pi

Edited by jeancf at 2015-12-16 17:05

Hi,

I want to report that I managed to get arch installed and running on the Orange Pi using the latest mainline u-boot and mainline linux kernel from arch (4.3.2).

You will find below the description of the process (.md file in attachment also). Once it is done, you can keep the installation updated using pacman, except for the u-boot as the package does not exist yet. I am going to check what it takes to officialize the support in arch. Probably contribute the u-boot package which I am happy to do.

Compile u-boot
### Download and configure toolchain ###

Go to http://www.linaro.org/downloads/, scroll down to *Linaro Toolchain* and download the file linked next to *linaro-toolchain-binaries (little-endian)*. The file should be named something like `gcc-linaro-<version>-<date>-x86_64-arm-linux-gnueabihf.tar.xz`

Extract the content of the archive to a folder and make sure that the `bin` folder of the package is in your `PATH`. It can be added for the current session only by using:
export PATH="$PATH":/home/user/folder/gcc-linaro-<VERSION>-<DATE>-x86_64_arm-linux-gnueabihf/bin/Specify that cross compilation to ARM should be used:
export CROSS_COMPILE=arm-linux-gnueabihf-
### Download and compile u-boot ###
Get latest stable u-boot from `ftp://ftp.denx.de/pub/u-boot/` and unpack.
In the main u-boot folder, execute `make Orangepi_defconfig` to configure u-boot.
Execute `make all` to build all the u-boot images for OrangePi.

Install archlinux on SD card

1. Clean up the beginning of the SD Card:
    Identify the name of your SD card by using `lsblk`.
dd if=/dev/zero of=/dev/sdX bs=1M count=8    where `/dev/sdX` is the name of the SD Card.
2. Partition the SD Card.
    Start by deleting all partitions that may already exist on the card.
    Create a primary partition starting and 2048 and extending to the end of the card
    Write the partition and exit
3. Create and mount the ext4 filesystem:
    mkfs.ext4 /dev/sdX1
    mkdir mnt
    mount /dev/sdX1 mnt    where `/dev/sdX1' is the name of the partition on the SD Card
4. Download and extract the root filesystem:
    wget http://archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz
    bsdtar -xpf ArchLinuxARM-armv7-latest.tar.gz -C mnt
    sync
Copy u-boot on SD card
1. Install the U-Boot bootloader:
    In the main u-boot folder where you compiled u-boot you will find the bootloader file called `u-boot-sunxi-with-spl.bin`
dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=82. Create a file called `boot.txt` with the following content
    part uuid ${devtype} ${devnum}:${bootpart} uuid
    setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait

    if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage; then
      if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
      if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
          bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
      else
          bootz ${kernel_addr_r} - ${fdt_addr_r};
      fi;
      fi;
    fi

    if load ${devtype} ${devnum}:${bootpart} 0x48000000 /boot/uImage; then
      if load ${devtype} ${devnum}:${bootpart} 0x43000000 /boot/script.bin; then
      setenv bootm_boot_mode sec;
      bootm 0x48000000;
      fi;
    fi3. Convert it to binary format:
    Install uboot-tools with `pacman -S uboot-tools`
    mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr
    cp boot.scr mnt/boot
    sync
    unmount /dev/sdX4. Insert the micro SD card into the pcDuino3, connect the USB or SATA drive, connect ethernet, and apply 5V power.
    Use the serial console or SSH to the IP address given to the board by your router.
    Login as the default user `alarm` with the password `alarm`.
    The default root password is `root`.


brewmaster post at 2016-1-14 15:26:25

What about `script.bin` and `uImage` files? Aren't they needed?

letroll post at 2016-2-28 19:34:30

@Jeancf thank you for your post, same question, no need of 'script.bin' ?
Ethernet is working?

jernej post at 2016-2-28 19:47:15

Mainline kernel doesn't use script.bin. It uses device tree instead for configuration. There is currently no ethernet driver in mainline, but first draft exist on linux-sunxi mail list.

exoid post at 2016-5-28 19:50:56

I tried to build archlinux for my Orange Pi PC, i used the lgcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf as toolchain and exactly followed the tutorial. But if i try to boot it doesnt work. I cant identify my problem. Could you help me?

huami post at 2016-11-8 15:01:07

Any idea of I can use Archlinux + mainline uBoot + mainline kernel on Orange PI One? I don't care much about the ethernet, but HDMI would be nice to have. Or instead of the mainline uBoot should I try this tree?
https://github.com/jelly/u-boot/tree/h3_video_hdmi

regards.

emmaorabelle post at 2023-7-13 10:59:19

Contributing the U-Boot package to Arch Linux would be a valuable contribution to the community. It can help make the installation process smoother for other users and potentially lead to official support for the Orange Pi in Arch Linux. Bitlife
page: [1]
View full version: Setting up arch + mainline kernel on Orange Pi