please choosego to mobile | Continue to access the PC version
View: 25749|Reply: 6

Setting up arch + mainline kernel on Orange Pi

[Copy link]

3

threads

12

posts

67

credits

Registered member

Rank: 2

credits
67
Published in 2015-12-16 05:50:56 | Show all floors |Read mode
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:
  1. export PATH="$PATH":/home/user/folder/gcc-linaro-<VERSION>-<DATE>-x86_64_arm-linux-gnueabihf/bin/
Copy code
Specify that cross compilation to ARM should be used:
  1. export CROSS_COMPILE=arm-linux-gnueabihf-
Copy code

### 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`.
  1. dd if=/dev/zero of=/dev/sdX bs=1M count=8
Copy code
   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:
  1.     mkfs.ext4 /dev/sdX1
  2.     mkdir mnt
  3.     mount /dev/sdX1 mnt
Copy code
   where `/dev/sdX1' is the name of the partition on the SD Card
4. Download and extract the root filesystem:
  1.     wget [url]http://archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz[/url]
  2.     bsdtar -xpf ArchLinuxARM-armv7-latest.tar.gz -C mnt
  3.     sync
Copy code

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`
  1. dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
Copy code
2. Create a file called `boot.txt` with the following content
  1.     part uuid ${devtype} ${devnum}:${bootpart} uuid
  2.     setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait

  3.     if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage; then
  4.       if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
  5.         if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
  6.           bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
  7.         else
  8.           bootz ${kernel_addr_r} - ${fdt_addr_r};
  9.         fi;
  10.       fi;
  11.     fi

  12.     if load ${devtype} ${devnum}:${bootpart} 0x48000000 /boot/uImage; then
  13.       if load ${devtype} ${devnum}:${bootpart} 0x43000000 /boot/script.bin; then
  14.         setenv bootm_boot_mode sec;
  15.         bootm 0x48000000;
  16.       fi;
  17.     fi
Copy code
3. Convert it to binary format:
    Install uboot-tools with `pacman -S uboot-tools`
  1.     mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr
  2.     cp boot.scr mnt/boot
  3.     sync
  4.     unmount /dev/sdX
Copy code
4. 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`.


This thread contains more resources

You need to Log in to download or view,No account?    Register

x

0

threads

1

posts

8

credits

Novice

Rank: 1

credits
8
Published in 2016-1-14 15:26:25 | Show all floors
What about `script.bin` and `uImage` files? Aren't they needed?

1

threads

4

posts

29

credits

Novice

Rank: 1

credits
29
Published in 2016-2-28 19:34:30 | Show all floors
@Jeancf thank you for your post, same question, no need of 'script.bin' ?
Ethernet is working?

4

threads

1118

posts

9531

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9531
Published in 2016-2-28 19:47:15 | Show all floors
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.

2

threads

4

posts

34

credits

Novice

Rank: 1

credits
34
Published in 2016-5-28 19:50:56 | Show all floors
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?

1

threads

4

posts

21

credits

Novice

Rank: 1

credits
21
Published in 2016-11-8 15:01:07 | Show all floors
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.

0

threads

29

posts

80

credits

Registered member

Rank: 2

credits
80
Published in 2023-7-13 10:59:19 | Show all floors
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
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list