Download presentation
Presentation is loading. Please wait.
1
Blackfin buildroot development
12/17/08 Blackfin buildroot development Aaron Wu ADI Open Source Solution
2
Agenda Getting started Blackfin Linux toolchain Blackfin Das-Uboot
Host machine environment How to get help Linux on bf609 quick start Blackfin Linux toolchain Download and install Tollchain for 3 formats Blackfin Das-Uboot Download, config, and compile Boot modes Blackfin Linux kernel & App Overview for Linux kernel/App running on Blackfin NO-MMU App development on Blackfin Linux comparing to ARM or Intel Arch Play with buildroot Overview Build an example target Buildroot skeleton Add a package in buildroot Make patch for a package work with git to submit patch Work with buildroot & package upstream Track tasks with sourceforge
3
Linux on Blackfin – Geting started
12/17/08 Linux on Blackfin – Geting started
4
Set up host machine Q: I have the Ubuntu installed on my host PC, what’s the next? A: Set up the host environment Install required packages on host PC: Install Blackfin Linux toolchain: tar jxvf blackfin-toolchain-2013R1-RC1.i386.tar.bz2 tar jxvf blackfin-toolchain-elf-gcc R1-RC1.i386.tar.bz2 tar jxvf blackfin-toolchain-uclibc-default-2013R1-RC1.i386.tar.bz2 Q: Where do I get the source code and binary? A: Download the release for u-boot, toolchain, and Blackfin Linux source code and binary from Note: Be sure to use the matched version of u-boot, toolchain and Linux, mix different versions up lead to unknown problems, and use the latest release version.
5
How to get help – support model
Q: I have a problem, I need support A: Asking questions on support forum: (English and Chinese) blackfin For toolchain For Linux distribution For U-boot Before submitting your question: Read the FAQ: Search the forum for historical issues When submitting your question, provide information: 1)detailed information for hardware environment and software version 2)log for the failure, along with your kernel and distribution configuration files 3)steps description to reproduce your failure Helpful document wiki: docs.blackfin.uclinux.org mailist:
6
quick start Set up the hardware environment Set up the host machine
Switch to the appropriate boot mode Connect the serial cable, eth cable, power supply. Set up the host machine Set up the terminal for Linux, minicom, N-1, HW flow control off Set up the tftp server for Linux 1) sudo apt-get install tftp-hpa tftpd-hpa 2) sudo vi /etc/default/tftpd-hpa, set the TFTP_DIRECTOR to you own directory 3) sudo service tftpd-hpa restart Run Default image U-boot environment setting Run Linux uImage Update the bootloader Transfer the image to board by Ethernet bfin> tftp 0x u-boot.ldr Flash to the serial Flash bfin> sf probe 2 ? bfin> sf erase 0x0 0x100000 bfin> sf write 0x x0 $SIZE Initially Load the bootloader bfin-uclinux-ldr -l u-boot.ldr
7
Linux on Blackfin – Toolchain
12/17/08 Linux on Blackfin – Toolchain
8
Installing toolchain Where to get
3 files needed, choose the right one according to your host pc hardware and software architectures blackfin-toolchain-2013R1-RC1.i386.tar.bz2 blackfin-toolchain-elf-gcc R1-RC1.i386.tar.bz2 blackfin-toolchain-uclibc-default-2013R1-RC1.i386.tar.bz2 An example procedure tar jxvf blackfin-toolchain-2013R1-RC1.i386.tar.bz2. tar jxvf blackfin-toolchain-elf-gcc R1-RC1.i386.tar.bz2 tar jxvf blackfin-toolchain-uclibc-default-2013R1-RC1.i386.tar.bz2 cp -fr opt/uClinux /opt Add to the PATH export PATH=$PATH:/opt/uClinux/bfin-uclinux/bin:/opt/uClinux/bfin-linux- uclibc/bin:/opt/uClinux/bfin-elf/bin Or edit the file ~/.bashrc to include the above line 8 8
9
Toolchain for 3 binary formats
FLAT bfin-uclinux-gcc Binary Flat files known as BFLT, relatively simple and lightweight executable format based on the original a.out format. BFLT files are the default file format in embedded Linux, automatically link the application with the Linux run time libraries, usually for static library linking. FDPIC ELF bfin-linux-uclibc-gcc originally developed by Unix System Laboratories and has become the standard in file formats. The ELF standard has greater power and more flexibility than the BFLT format. However, they are more heavyweight, requiring more disk space and having a small run-time penalty, usually for dynamic library linking. Bear metal bfin-elf-gcc used for Non-OS applications, nothing to do with Linux, one example is code running on coreB of BF561/BF609. FLAT and FDPIC can be selected from choosing different configuration file 9 9
10
Linux on Blackfin – U-boot
12/17/08 Linux on Blackfin – U-boot
11
U-boot – src download/compile
12/17/08 U-boot – src download/compile Git clone and check out the source git clone git://git.code.sf.net/p/adi-u-boot/code adi-u-boot-code git checkout 2013R1 Configure and compile vim include/configs/bf609-ezkit.h make bf609-ezkit Flash the u-boot By gnICE bfin-jtag cable gnICE detect businit YOUR_BOARD detectflash flashmem 0x u-boot.ldr By uart-utils: bfin-uclinux-ldr -l u-boot.ldr connect to minicom, the uart version of u-boot is running use the runing u-boot to tftp load and flash bootloader 11 11
12
Bootmode selection 12 Support various booting methods How to select
12/17/08 Bootmode selection Support various booting methods Parallel NOR Flash SPI NOR Flash SD/MMC card (BF60x) UART How to select H/W design, Input Pins BMODE[2:0] to select the booting mode ROM code will check the BMODE Pins and choose the source accordingly In board configuration file, define the CONFIG_BFIN_BOOT_MODE properly 12 12
13
12/17/08 Linux on Blackfin
14
Linux running on Blackfin – Big Picture
12/17/08 Linux running on Blackfin – Big Picture Userspace Application (Customer) Opensource Library C Library (uClibc) Linux Kernel (supervisor) Device Driver Device Driver Framework B / Hardware
15
Application porting and development
API difference Use vfork instead of fork, and _exit instead of exit A fork produces a parent and child. Each have individual task control structures and each can be scheduled independently by the kernel. When we have an MMU the parent and child eventually occupy different physical memory spaces. The MMU maps different physical memory addresses to identical virtual memory addresses and copies the data from parent to child Using thread APIs Memory allocation Because there is no virtual memory map, an uClinux application should try not to allocate and free dynamic memory continually, to avoid fragmenting memory. Application are recommended to malloc all memory at start up or manage allocation by itself, nedmalloc is one option for memory pool. Fixed stack size default stack size for FLAT binaries is 4k (0x1000) bytes default stack size for FDPIC ELF binaries is 128k (0x20000) bytes Stacksize can be modified with flthdr like “flthdr -s 8192 application”
16
12/17/08 Play with Buildroot
17
Buildroot introduction
12/17/08 Buildroot introduction Made up of many configure scripts, make files and directories, allows you to easily add configuration options, documentation, dependencies, and integrate into Makefiles Tree overview board/ — board specific kernel configuration files boot/ — boot loader config scripts and make files; not used for blackfin config/ — the buildroot default configuration for different boards dl/ — the source tarballs that are downloaded during building process docs/ — how to configure and customize buildroot fs/ — config scripts and make files to build different kinds of root file system image. linux/ — config scripts, make files to build Linux kernel linux/linux-kernel/ — the Linux kernel source linux/patch/ — Patches to apply to the proper version of Linux kernel source output/ — All building output files are put under this folder output/build/ — Contain binaries of all software packages output/images/ — Contain file system images and kernel booting up images. output/staging/ — locally installed (“staged”) target libraries; they may be linked with target applications later output/target/ — the compiled root file system image packages/ — config scripts and make files to download and build libraries and applications testsuites/ — scripts for testing various boards/packages/kernels/etc... scripts/ — misc buildroot compile helper scripts target/ — vendor-specific configuration files and build instructions toolchain/ — GNU toolchain and GDB config scripts and make files 17 17
18
Build a target 18 Build a target
12/17/08 Build a target Build a target git clone git://git.code.sf.net/p/adi-buildroot/code adi-buildroot-code cd adi-buildroot-code git checkout 2013R1 git submodule update –init cd linux/linux-kernel/ cd ../../ cd testsuites/ make bf609-ezkit_defconfig make cp output/images/uImage /tftpboot/ 18 18
19
Buildroot skeleton 19 Configure buildroot and linux-kernel
12/17/08 Buildroot skeleton Configure buildroot and linux-kernel make menuconfig make linux-menuconfig Buildroot skeleton configs/bf609-ezkit_defconfig .config Config.in packages dl output/build/ output/build/*/.stamp_* Linux/linux-kernel 19 19
20
Add a package in buildroot
12/17/08 Add a package in buildroot diff --git a/package/Config.in b/package/Config.in --- a/package/Config.in +++ b/package/Config.in -714,6 +714,7 source "package/snowball-init/Config.in" source "package/bfin-dma/Config.in" +source "package/sport_test/Config.in" source "package/bfin-canned-demos/Config.in" diff --git a/package/sport_test/Config.in b/package/sport_test/Config.in --- /dev/null +++ b/package/sport_test/Config.in -0,0 +1,4 +config BR2_PACKAGE_SPORT_TEST + bool "bfin common sport test" + help + Bfin common sport test suite diff --git a/package/sport_test/sport_test.mk b/package/sport_test/sport_test.mk +++ b/package/sport_test/sport_test.mk …. more detail check the patch file 20 20
21
Make patch for buildroot package
12/17/08 Make patch for buildroot package Get the original version of codege organization type cp adi-buildroot-code/dl/alsa-utils tar.bz2 . tar jxvf alsa-utils tar.bz2 Make a copy of the original code and make changes on it cp alsa-utils alsa-utils _new vim alsa-utils /alsactl/init_utils_run.c Diff to make a code patch diff –Nurp alsa-utils alsa-utils _new > alsa-utils.patch Move the diff generated patch to buildroot package directoryzation type cp alsa-utils.patch buildroot/package/multimedia/alsa-utils 21 21
22
Work with git 22 Frequently used git commandsackage organization type
12/17/08 Work with git Frequently used git commandsackage organization type git clone git checkout git branch git pull git commit git reset --hard Format and submit a patch git add alsa-utils.patch git commit –a –s add the comment git format patch -1 edit the patch to add comments git send- git push git send- set up exmple: 22 22
23
23 Work with buildroot & package upstream Buildrootion type
12/17/08 Work with buildroot & package upstream Buildrootion type website: subscribe to mailist: Other packages website: by google mailist: by google Submit patches to upstream better to work on the git repository when possible, and send patches with git send- submit patch to both buildroot and specific package mailist/maintainer. 23 23
24
24 Use sourceforge to track the tickets
12/17/08 Use sourceforge to track the tickets 24 24
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.