Table of Contents

Build and run Linux-3.0

Buildroot is a set of Makefiles and patches that makes it easy to generate a complete embedded Linux system. Buildroot can generate any or all of a cross-compilation toolchain, a root filesystem, a kernel image and a bootloader image.

Download

Build

BSP already configured for SPARC with hardware MUL (V8) and FPU. The rootfs will be located in the initrd ramfs inside the kernel. For that would build all of this do:

make

This will build toolchain, rootfs image and linux kernel. Check that all is well possible for the new files in output/images: rootfs.initramfs and zImage

DSU image

For build DSU image change dir to board/leon3 and run:

 ./make_dsu

It creates a file output/images/image.dsu. Start grmon (with -nb):

grmon-eval -uart /dev/ttyUSB0 -baud 460800 -nb

Load and run image:

grlib> load image.dsu
section: .stage2 at 0x40000000, size 10240 bytes
section: .vmlinux at 0x40004000, size 3582524 bytes
total size: 3592764 bytes (329.2 kbit/s)
read 10539 symbols
entry point: 0x40000000
grlib> run

Serial console with baud rate 38400 out is:

PROMLIB: Sun Boot Prom Version 0 Revision 0
Linux version 3.0.0 (master@linux-xynp) (gcc version 4.4.5 (Buildroot 2011.02) ) #2 Fri Jul 29 22:43:40 MSD 2011
bootconsole [earlyprom0] enabled
ARCH: LEON
TYPE: Leon3 System-on-a-Chip
Ethernet address: 00:00:7c:cc:01:45
CACHE: direct mapped cache, set size 4k
CACHE: not flushing on every context switch
Boot time fixup v1.6. 4/Mar/98 Jakub Jelinek (jj@ultra.linux.cz). Patching kernel for srmmu[LEON]/iommu
OF stdout device is: /a::a
PROM: Built device tree with 9379 bytes of memory.
Booting Linux...
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 15355
Kernel command line: console=ttyS0,38400 rootfs=/dev/ram0 init=/sbin/init 
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 59116k/65536k available (2108k kernel code, 6420k reserved, 536k data, 840k init, 0k highmem)
NR_IRQS:64
Console: colour dummy device 80x25
console [ttyS0] enabled, bootconsole disabled
console [ttyS0] enabled, bootconsole disabled
Calibrating delay loop... 72.90 BogoMIPS (lpj=364544)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
NET: Registered protocol family 16
bio: create slab <bio-0> at 0
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 115
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: GRLIB APBUART driver
80000001: ttyS0 at MMIO 0x80000100 (irq = 2) is a GRLIB/APBUART
grlib-apbuart at 0x80000100, irq 2
brd: module loaded
loop: module loaded
TCP cubic registered
NET: Registered protocol family 17
Registering the dns_resolver key type
leon: power management initialized
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
Freeing unused kernel memory: 840k freed
Initializing random number generator... done.

Welcome to Buildroot
buildroot login: 

Login “root” without password.

Tests

You can try dhrystone test:

# dhrystone 

Dhrystone Benchmark, Version 2.1 (Language: C)

Program compiled without 'register' attribute

Please give the number of runs through the benchmark: 400000

Execution starts, 400000 runs through Dhrystone
Execution ends

Final values of the variables used in the benchmark:

Int_Glob:            5
        should be:   5
Bool_Glob:           1
        should be:   1
Ch_1_Glob:           A
        should be:   A
Ch_2_Glob:           B
        should be:   B
Arr_1_Glob[8]:       7
        should be:   7
Arr_2_Glob[8][7]:    400010
        should be:   Number_Of_Runs + 10
Ptr_Glob->
  Ptr_Comp:          151560
        should be:   (implementation-dependent)
  Discr:             0
        should be:   0
  Enum_Comp:         2
        should be:   2
  Int_Comp:          17
        should be:   17
  Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
        should be:   DHRYSTONE PROGRAM, SOME STRING
Next_Ptr_Glob->
  Ptr_Comp:          151560
        should be:   (implementation-dependent), same as above
  Discr:             0
        should be:   0
  Enum_Comp:         1
        should be:   1
  Int_Comp:          18
        should be:   18
  Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
        should be:   DHRYSTONE PROGRAM, SOME STRING
Int_1_Loc:           5
        should be:   5
Int_2_Loc:           13
        should be:   13
Int_3_Loc:           7
        should be:   7
Enum_Loc:            1
        should be:   1
Str_1_Loc:           DHRYSTONE PROGRAM, 1'ST STRING
        should be:   DHRYSTONE PROGRAM, 1'ST STRING
Str_2_Loc:           DHRYSTONE PROGRAM, 2'ND STRING
        should be:   DHRYSTONE PROGRAM, 2'ND STRING

Microseconds for one run through Dhrystone:   16.5 
Dhrystones per Second:                      60514.4 

Or Lua language interpreter:

# lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> print(2+2)
4
> 

Customizing

That would adjust the toolchain or rootfs package selection do:

 make menuconfig

For customize busybox do:

make busybox-menuconfig

And for tuning linux kernel do:

make linux-menuconfig

After that everything must be rebuilt:

make

And do not forget rebuild the DSU image

Prebuild image