world leader in high performance signal processing
Trace: » build_a_target

Configure and build buildroot distribution

To build buildroot distribution for Blackfin, you should first download and install the corresponding version of GNU toolchain for Blackfin from http://sourceforge.net/projects/adi-toolchain/files/2013R1/. Make sure you add the path into your environment parameters.

Latest released source tar ball of buildroot can be download from http://sourceforge.net/projects/adi-buildroot/files/2013R1/.

To build buildroot from GIT SCM, please checkout following tags.

Build buildroot source from GIT

Checkout buildroot source code as anonymous user

> git clone git://git.code.sf.net/p/adi-buildroot/code adi-buildroot-code
> cd buildroot
> git checkout 2012R2-RC5
or
> git checkout -b 2012R2 remotes/origin/2012R2

Checkout Linux kernel and testsuite submodule source code

> git submodule update --init
Enter password: anonymous
> cd linux/linux-kernel/
> git checkout 2012R2-RC5
or
> git checkout -b 2012R2 remotes/origin/2012R2
> cd ../../
> cd testsuites/
> git checkout 2012R2-RC5
or
> git checkout -b 2012R2 remotes/origin/2012R2
> cd ../

Build with default configuration and prepare uImage for tftp boot over Ethernet.

> make bf609-ezkit_defconfig
> make
> cp output/images/uImage /tftpboot/

Configure buildroot

There are 3 ways to configure buildroot.

  1. make config to start command line configuration
  2. make menuconfig to prompt ncurse based text window configuration
  3. make xconfig to prompt QT based graphic menu configuration

Customize kernel and application in Buildroot

To customize Linux kernel:

> make linux-menuconfig

To customize software packages, such as busybox:

> make busybox-menuconfig

To customize userspace software packages:

> make menuconfig

If you are using buildroot with full uclibc toolchain, below extra configuration is needed.

Toolchain  --->    
     [*] Toolchain has IPv6 support?
     [*] Toolchain has WCHAR support?   

Build a package

Any software package in buildroot can be built, install and clean individually.

To build a specific package source:

> make busybox

To install binaries of a specific package:

> make busybox-install

To clean all built files in a specific package:

> make busybox-clean

To reconfigure a specific package:

> make busybox-reconfigure

To rebuild a specific package:

> make busybox-rebuild

Build external source on local disk

Some customer's application source code is on local disk other than a remote source server. You can direct buildroot to use local source in your package's make file by macro <PACKAGE>_OVERRIDE_SRCDIR.

If the local source package is generated by GNU autotools, define ”<PACKAGE>_OVERRIDE_SRCDIR = your source path” is all you need to do. Otherwise, you have to define the other macro ”<PACKAGE>_OVERRIDE_RSYNC = yes” as well. This macro tells buildroot to copy your source code to folder “buildroot/output/build/<PACKAGE>_custom/” before compiling.

The buildroot make file for your local source may look like:

VIDEO_TEST_OVERRIDE_SRCDIR = /home/sonic/projects/test/video_test
VIDEO_TEST_OVERRIDE_RSYNC = yes

define VIDEO_TEST_BUILD_CMDS
        $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS)
endef

define VIDEO_TEST_INSTALL_TARGET_CMDS
        if ! [ -d "$(TARGET_DIR)/bin/" ]; then \
                mkdir -p $(TARGET_DIR)/bin/; \
        fi
        $(INSTALL) -D -m 0755 $(@D)/video_test $(TARGET_DIR)/bin/
endef

define VIDEO_TEST_CLEAN_CMDS
        $(MAKE) -C $(@D) clean
endef

define VIDEO_TEST_UNINSTALL_TARGET_CMDS
        rm -f $(TARGET_DIR)/bin/video_test
endef

$(eval $(generic-package))

Increment building

Buildroot depends on 2 increment building system. The traditional Makefile based system decides which files need to be built within a software package, while time stamp file based system decides which build steps apply to a specific software package.

There are 6 types of building steps and corresponding time stamp files. The 6 steps are executed in sequence for each software package. If any source file is revised, .stamp_built and later stamps should be removed before do rebuilding. If auto configuration scripts are revised, .stamp_configured and later stamps should be removed. If patches are revised, .stamp_patched and later stamps should be removed.

  1. .stamp_downloaded
  2. .stamp_extracted
  3. .stamp_patched
  4. .stamp_configured
  5. .stamp_built
  6. .stamp_target_installed

To rebuild or clean linux-kernel or busybox, you don't need to remove any stamp files manually. Just run:

user:~/buildroot/> make linux-rebuild

user:~/buildroot/> make linux-clean

user:~/buildroot/> make busybox-rebuild

user:~/buildroot/> make busybox-clean

A software package can be excluded from building by unselecting it in buildroot configuration. But it's binary is still in the target rootfs folder. To remove it completely, you can need to run make packagename-clean, which will remove its building folder as well as uninstall its binaries.

Boot buildroot image to console

Connect the serial cable and Ethernet cable to host PC, start minicom and hit the reset button on BF609-EZKIT.

U-Boot 2011.09-00208-gdaa2b65-dirty (ADI-2012R1-BETA1-BF60X) (Apr 19 2012 - 15:41:44)

CPU:   ADSP bf609-0.0 (Detected Rev: 0.0) (spi flash boot)
Board: ADI BF609 EZ-Kit board
       Support: http://blackfin.uclinux.org/
Clock: VCO: 25 MHz, Core: 500 MHz, System0: 100 MHz, System1: 100 MHz, Dclk: 250 MHz
RAM:   128 MiB
Flash: 16 MiB
MMC:   Blackfin SDH: 0
SF: Detected W25Q32 with page size 4 KiB, total 4 MiB
In:    serial
Out:   serial
Err:   serial
KGDB:  [on serial] ready
other init
Net:   mii0
Hit any key to stop autoboot:  0 
bfin> boot
Using mii0 device
TFTP from server 10.100.4.174; our IP address is 10.100.4.60
Filename 'uImage'.
Load address: 0x1000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###########################################
done
Bytes transferred = 10536016 (a0c450 hex)
## Booting kernel from Legacy Image at 01000000 ...
   Image Name:   bf609-0.0-3.3.0-ADI-2012R1-BETA1-BF60X-0
   Image Type:   Blackfin Linux Kernel Image (gzip compressed)
   Data Size:    10535952 Bytes = 10 MiB
   Load Address: 00001000
   Entry Point:  0027d9ac
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
Starting Kernel at = 0027d9ac
Linux version 3.3.0-ADI-2012R1-pre-00579-gf724383-dirty (sonic@nine) (gcc version 4.3.5 (ADI-BF60x_2012R1-BETA2) ) #2 Fri Apr 20 16:37:13 CST 2012
register early platform devices
bootconsole [early_shadow0] enabled
ERROR: Not running on ADSP-BF609: unknown CPUID 0x0000 Rev 0.0
bootconsole [early_BFuart0] enabled
early printk enabled on early_BFuart0
Board Memory: 128MB
Kernel Managed Memory: 128MB
Memory map:
  fixedcode = 0x00000400-0x00000490
  text      = 0x00001000-0x001b4810
  rodata    = 0x001b4834-0x00244004
  bss       = 0x00245000-0x00257a70
  data      = 0x00257a70-0x0027a000
    stack   = 0x00278000-0x0027a000
  init      = 0x0027a000-0x00b56000
  available = 0x00b56000-0x07f00000
  DMA Zone  = 0x07f00000-0x08000000
Hardware Trace active and enabled
Blackfin support (C) 2004-2010 Analog Devices, Inc.
Compiled for ADSP-BF609 Rev 0.0
Blackfin Linux support by http://blackfin.uclinux.org/
Processor Speed: 500 MHz core clock and 100 MHz System Clock
NOMPU: setting up cplb tables
Instruction Cache Enabled for CPU0
  External memory: cacheable in instruction cache
  L2 SRAM        : uncacheable in instruction cache
Data Cache Enabled for CPU0
  External memory: cacheable (write-back) in data cache
  L2 SRAM        : uncacheable in data cache
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 32258
Kernel command line: root=/dev/mtdblock0 rw clkin_hz=(25000000) earlyprintk=serial,uart0,57600 console=ttyBF0,57600 ip=10.100.4.60:10.100.4.174:10.99.24.1:2f
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory available: 117272k/131072k RAM, (9072k init code, 1742k kernel code, 790k data, 1024k dma, 1172k reserved)
NR_IRQS:299
Configuring Blackfin Priority Driven Interrupts
Console: colour dummy device 80x25
console [ttyBF0] enabled, bootconsole disabled
console [ttyBF0] enabled, bootconsole disabled
Calibrating delay loop... 995.32 BogoMIPS (lpj=1990656)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Blackfin Scratchpad data SRAM: 4 KB
Blackfin L1 Data A SRAM: 16 KB (9 KB free)
Blackfin L1 Data B SRAM: 16 KB (16 KB free)
Blackfin L1 Instruction SRAM: 64 KB (51 KB free)
Blackfin L2 SRAM: 256 KB (256 KB free)
NET: Registered protocol family 16
gpiochip_add: registered GPIOs 0 to 111 on device: BFIN-GPIO
Blackfin DMA Controller
ezkit_init(): registering device resources
ezkit_init(): request emac pins failed
bio: create slab <bio-0> at 0
SCSI subsystem initialized
bfin-spi bfin-spi.0: bfin-spi probe success
bfin-spi bfin-spi.1: bfin-spi probe success
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c-bfin-twi i2c-bfin-twi.0: Blackfin BF5xx on-chip I2C TWI Contoller, regs_base@ffc01e00
i2c-bfin-twi i2c-bfin-twi.1: Blackfin BF5xx on-chip I2C TWI Contoller, regs_base@ffc01f00
NET: Registered protocol family 23
Switching to clocksource bfin_cs_cycles
musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
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
msgmni has been set to 229
io scheduler noop registered (default)
bfin-uart: Blackfin serial driver
bfin-uart.0: ttyBF0 at MMIO 0xffc02000 (irq = 96) is a BFIN-UART
Blackfin hardware CRC driver
bfin-crc bfin-crc.0: initialized
bfin-crc bfin-crc.1: initialized
bf60x platform flash device: 01000000 at b0000000
bf60x-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000089 Chip ID 0x008821
Intel/Sharp Extended Query Table at 0x010A
Intel/Sharp Extended Query Table at 0x010A
Intel/Sharp Extended Query Table at 0x010A
Intel/Sharp Extended Query Table at 0x010A
Intel/Sharp Extended Query Table at 0x010A
Using buffer write method
Using auto-unlock on power-up/resume
cfi_cmdset_0001: Erase suspend on write enabled
Creating 3 MTD partitions on "bf60x-flash.0":
0x000000000000-0x000000080000 : "bootloader(nor)"
0x000000080000-0x000000480000 : "linux kernel(nor)"
0x000000480000-0x000001000000 : "file system(nor)"
m25p80 spi0.1: w25q32 (4096 Kbytes)
Creating 3 MTD partitions on "m25p80":
0x000000000000-0x000000080000 : "bootloader(spi)"
0x000000080000-0x000000200000 : "linux kernel(spi)"
0x000000200000-0x000000400000 : "file system(spi)"
CAN device driver interface
bfin_can bfin_can.0: bfin_can device registered(&reg_base=ffc00a00, rx_irq=55, tx_irq=56, err_irq=57, sclk=100000000)
        DWMAC100
 No HW DMA feature register supported
 Enhanced/Alternate descriptors
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
input: bfin-rotary as /devices/platform/bfin-rotary/input/input0
i2c /dev entries driver
bfin-wdt: initialized: timeout=20 sec (nowayout=0)
dma_alloc_init: dma_page @ 0x0523f000 - 256 pages at 0x07f00000
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP cubic registered
NET: Registered protocol family 17
can: controller area network core (rev 20090105 abi 8)
NET: Registered protocol family 29
eth0: device MAC address 16:04:81:fd:e1:70
stmmac: probed
eth0: PHY ID 20005c90 at 1 IRQ 0 (stmmac-0:01) active
 No MAC Management Counters available
IP-Config: Gateway not on directly connected network.
Freeing unused kernel memory: 9072k freed


BusyBox v1.17.4 (2012-04-20 16:20:11 CST) hush - the humble shell

root:/> PHY: stmmac-0:01 - Link is Up - 100/Full

root:/> 
root:/>