Installing Linux


2012-03-26Publicerad av Sven-Åke Andersson

Introduction


The Linux kernel has been ported to the OpenRISC 1000 family. The OpenRISC Linux kernel is a free and open source operating system. Features are:

  • Free, open source code with no royalty
  • UNIX class operating system
  • Process protection through use of the Memory Management Unit
  • Multitasking, preemptive scheduling
  • Interprocess communication and synchronization
  • TCP/IP networking and numerous other network protocols
  • File systems NFS, ext2, MS-DOS, FAT16/32 and others


Status


Kernel version is tracking mainline. It is capable of booting and running BusyBox userspace. The C library providing user space support is uClibc.

Download source


At present the Linux port is maintained by Jonas Bonn of South Pole and kept in their git repositories. To obtain a copy of the kernel tree source with OpenRISC support, ensure git is installed and run:

git clone git://git.openrisc.net/jonas/linux

 


 
Here is what the installation looks like:

 

 

Setting CROSS_COMPILE


We must set the environment variable CROSS_COMPILE in our shell before starting the Linux kernel build. Lets add this line in our .bashrc file:

export CROSS_COMPILE=or32-elf-
 

Build the Linux kernel

 
The following commands will build a kernel. Note that there is a build of BusyBox pre-configured in the initial ramdisk file system:

cd ..../OpenRISC/linux
make defconfig
make

 







 
The vmlinux ELF file is converted and copied to the vmlinux.bin file at the end of the make session.

 
 

Run the kernel in the simulator


Use the following command to run the Linux kernel in the OpenRISC architectural simulator (or1ksim):

or32-elf-sim -f arch/openrisc/or1ksim.cfg vmlinux
 

Changing the uart setup


The first time we run the simulator it hangs at the following setup:

 
ll


Changing the UART setup in the or1ksim config file fixes the problem. We add an xterm terminal to be used as input/ouput device.

 

 

Linux up and running

 
We can enter commands in the xterm window:

 

 

Installing Linux on the Atlys board


The standard OpenRISC Linux kernel port contains enough to boot the kernel and present the user with a console prompt via the serial port. The following guide uses the Atlys development board as an example target for kernel configuration, compilation and download.
 

Atlys device tree setup


The Atlys FPGA design has a slightly different configuration than the simulator, which we need to tell the kernel about. Linux represents hardware as a device tree in a .dts file.

 



I've created a simple device tree for the Atlys board and put it in the: arch/openrisc/boot/dts/ directory.

 

l


Compared to the or1ksim.dts, it sets the processor and USART clock speed to the correct 50MHz.


Kernel configuration


We will use the menuconfig tool to configure the kernel for our board.

make menuconfig

 

 
Select  Processor type and features and hit RETURN.

 

and change or1ksim to atlys.
 


 
Save and run make again.
 

Generate an downloadable linux image


Use this command to generate an image that can be downloaded from U-boot.

cd ......./orpsocv2/u-boot
./tools/mkimage -n 'Linux for OpenRISC' -A or1k -O linux -T kernel -C none -a 0 -e 0x100 -d /opt/home/svan/OpenRISC/linux/vmlinux.bin /tftpboot/uImage

 

Download the linux image


From U-boot use the following command to download the Linux image to the SDRAM:

tftp uImage


 

 

Boot Linux
 

We are ready to boot linux: bootm 100000


 
l

A lot of text printed.
 


 
We got the Linux prompt.
 

 

Linux version


# more version
Linux version 3.3.0-rc3-10289-g6096074-dirty (svan@Superdatorn) (gcc version 4.5.1-or32-1.0rc4 (OpenRISC 32-bit toolchain for or32-elf (built 20110410)) ) #7 Mon Mar 26 15:25:53 CEST 2012