Skip to content

How to quickly get started with Linux for ARC cores with prebuilt components

Vineet Gupta edited this page May 14, 2015 · 23 revisions

(A) Introduction

A minimal Designware ARC Linux system comprises of follow components:

  1. Linux kernel built for a specific core (ARC770D or HS38x) and the corresponding supported board/platform
  • nSIM OSCI Linux Virtual Platform (VP) for both ARC770D and HS38
  • DesignWare ARC FPGA Software Development Platforms (SDP): AXS101 (ARC 770D based), AXS103 (HS38x based)
  1. rootfs (root file system) containing system libraries (libc.so, libm.so ...), system programs (init, shell ...) and utilities (mount, ls ...) which are executed after bootup
  2. Host GNU toolchain to generate one/both of the above from the corresponding sources: essentially to cross-compile anything to run for ARC on typical x86 host

Typically Root file system is hosted on a persistent storage media such as SD Card or Disk or network share. However to reduce external dependencies specially in simulation environments, and to quickly get started, we will build ARC Linux with an initramfs (CONFIG_INITRAMFS_SOURCE) where the rootfs is embedded within kernel image at build time.

Typically embedded systems use a bootloader which we will avoid here for the sake of simplicity (although u-boot is well supported for both ARC cores).

As the title suggests this document covers manual build using more of prebuilt components. There's a richer build environment based on Buildroot project which u can use to build a customized/tweaked ARC Linux system from scratch. Refer to https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/wiki/How-to-build-filesystem-and-kernel-images-for-ARC-cores-with-Buildroot

(B) Prerequisites

(1). This document assumes a Linux host (even if it is a VM such as VirtualBox/VMware Player) or a Linux server

(2). We will use a prebuilt Busybox based rootfs which can be download from SNPS github portal. There's a different rootfs for HS38 and ARC700 as they correspond to binary incompatible Instructions Sets (ISA): ARCv2 and ARCompact respectively.

For Linux for ARC HS38:

$ wget --no-check-certificate https://raw.githubusercontent.com/foss-for-synopsys-dwc-arc-processors/arc_initramfs_archives/master/arc_initramfs_HS_1410-stable4.8-sync-file-fix.tgz
$ tar -jxvf arc_initramfs_HS_1410-stable4.8-sync-file-fix.tgz   # generates directory arc_initramfs_hs

For Linux for ARC 770D:

$ wget --no-check-certificate https://raw.githubusercontent.com/foss-for-synopsys-dwc-arc-processors/arc_initramfs_archives/master/ARC700/arc_initramfs_12_2013_gnu_4_8_ABI_v3.tgz
$ tar -jxvf arc_initramfs_12_2013_gnu_4_8_ABI_v3.tgz  # generates directory arc_initramfs

(3). ARC GNU toolchain As of this writing (May 2015) building Linux for HS38 vs. ARC700 core requires a differently configured/built GNU toolchain [footnote]. Since the gcc driver is named the same for both (arc-linux-uclibc-gcc), please ensure you use the right variant of toolchain.

$ csh
$ module avail arc_gnu
--------------- /global/etc/modulefiles/freeware/opensource -------------------------
arc_gnu/2014.12-elf32(default) arc_gnu/2014.12-linux-arc700   arc_gnu/2014.12-linux-archs

(4). Prepend GNU toolchain's bin folder to PATH $ export PATH=/abs-path-to-gnu-tools/bin:$PATH

(C) Building ARC Linux kernel

(1). Downloading/building kernel might require some additional host packages (git, make, ncurses-devel...) to be installed on Host machine. This might vary for your host distro (RedHat or Debain etc)

(2). Downloading ARC Linux kernel sources Although ARC Linux is supported in upstream kernel repository maintained by Linus Torvalds (https://www.kernel.org/), as of this writing (May 2015), only ARC700 cores are supported. so get the kernel hosted at SNPS github site.

  • Using git to fetch the kernel repository
$ git clone https://github.com/foss-for-synopsys-dwc-arc-processors/linux.git
$ cd linux ; git checkout -t -b arc-3.18 origin/arc-3.18
  • Downloading the kernel source tarball
$ wget https://github.com/foss-for-synopsys-dwc-arc-processors/linux/archive/arc-3.18.zip
$ tar -zxvf arc-3.18.zip ; cd linux

Note that the initramfs extracted in step (B)2 and kernel source need to be at same directory hierarchy.

(3). Configure Linux kernel for a specific ARC Core / platform
For each supported platform, ARC Linux contains a "defconfig" which preselects the right ISA, cpu, relevant device drivers etc.
AXS103 SDP : $ make ARCH=arc axs103_defconfig
AXS101 SDP : $ make ARCH=arc axs101_defconfig
OSCI VP for HS38 : $ make ARCH=arc nsimosci_hs_defconfig
OSCI VP for HS38x2: $ make ARCH=arc nsimosci_hs_smp_defconfig
OSCI VP for ARC770: $ make ARCH=arc nsimosci_defconfig

(4). Build the kernel image

$ make ARCH=arc -j

The kernel binary vmlinux is generated

(D) Troubleshooting

  1. On SNPS Farm Machines, default versions of make or git might not work /depot/git-1.8.4.3/bin/git /depot/make-3.82.bin/make

  2. Trouble accessing github

Clone this wiki locally