Linux BSP User Manual (kernel 3.4.39)

1. Introduce
This document describes how to set up your development environment to build Linux BSP which provides from Nexell NXP4330/S5P4418/S5P6818.

[Note]

=> NXP4330 chipset regards to S5P4418.

 

2. Linux BSP Structure
Linux BSP structure created as below.

  • Bootloader : u-boot-2014.07 source
  • Kernel : Kernel 3.4.39 source
  • Platform :Platform Dependencies
  • Prototype : Chipset features

 

2.1. Platform Structure

  • common
    • fs : File system directory
    • buildroot : Root file system making tool
      tools : Tool directory (include toolchain)
  • s5p4418 : s5p4418 features
  • s5p6818 : s5p6818 features

2.1.1. NXP4330/S5P4418 Platform Sub Structure

  • boot
    • 2ndboot : 2ndboot binary
    • nsih : NSIH text files
  • apps
    • adc_test : ADC test application.
    • cec_test : HDMI CEC test application
    • fb_test : Framebuffer test application
    • gpio_test : GPIO test application
    • jpeg_test : JPEG encoding/decoding test application
    • nmea_test : NMEA parser test application
    • spi_test : SPI module test application
    • transcoding_example : Transcoding example application
    • typefind_app : Finding media information test application
    • v4l2_test : V4L2 camera test application
    • vip_test : VIP module camera test application
    • vpu_test : Video encoding/decoding test application
    • vpu_test2 : Codec test application
  • library
    • include : Common library include directory
    • lib : Library src output directory
    • src : Library source directory
      • libion : ION memory allocator library
      • libnxmalloc : Video memory allocatior library
      • libnxv4l2 : V4L2 wrapper libarary for display & camera capture
      • libnxvpu : Video encoding/decoding ioctl wrapper library
      • libnxjpeg : JPEG library
      • libnxdeinterlace : Deinterlace processing library
      • libhevc : HEVC library
      • libnxscaler : Fine scaler library
      • libnxgraphictools : 3D graphic library
      • libcec : HDMI CEC library
      • libnxadc : ADC library
      • libnxgpio : GPIO control library
      • libnxaudio : Audio control library
      • libnxpwm : PWM control library
      • libnxiso7816 : ISO7816 supported library
      • libxnuevent : User event handling library
      • libnxnmeaparser : NMEA parser library
  • modules
    • coda960 : Video encoding/decoder H/W accelator driver
  • doc
    • CodecAPI : Codec API Guide document
    • etc : ISO7816 API User Manual document

2.1.2. S5P6818 Platform Sub Structure

  • apps
    • v4l2_test : V4L2 camera deinterlace test application.
    • vpu_test : Video encoding/decoding test application.
  • library
    • include : Common library include directory
    • lib : Library src output directory
    • src : Library source directory
      • libion : ION memory allocator library.
      • libnxmalloc : Video memory allocatior library.
      • libnxdeinterlace : Deinterlace processing library
      • libnxv4l2 : V4L2 wrapper libarary for display & camera capture
      • libnxvpu : Video encoding/decoding ioctl wrapper library
      • libnxscaler : Fine scaler library
      • libnxgraphictools : 3D Graphic Library
      • libcec : HDMI CEC library
      • libnxuevent : User event handling library
  • modules
    • coda960 : Video encoding/decodubg H/W accelator driver

 

2.2. Memory Map

  • U-BOOT 1G Physical Memory MAP
CFG_MEM_PHY_SYSTEM_BASE physical memory start address 0x40000000
CFG_MEM_PHY_SYSTEM_SIZE physical memory size 0x40000000

 

0x80000000 Physical end
~
0x48000000 DownLoad CFG_MEM_LOAD_ADDR
~
0x47000000 BMP LOAD CFG_BMP_ADDR
0x46000000 Framebuffer CFG_MEM_PHY_FB_BASE
~
0x43000000 U-Boot HEAP END CONFIG_SYS_MALLOC_START + LENGTH
0x41000000 U-Boot HEAP START CONFIG_SYS_MALLOC_START
0x40000000 Physical start CFG_MEM_PHY_SYSTEM_BASE
  • Kernel 1G Physical Memory MAP
CFG_MEM_PHY_SYSTEM_BASE physical memory start address 0x40000000
CFG_MEM_PHY_SYSTEM_SIZE physical memory size 0x3F000000
CFG_MEM_PHY_DMAZONE_SIZE “ZONE_DMA” allocator memory area 0x01000000

 

2.3. Configuration

2.3.1. U-boot configuration

  • include/configs
    • [chipset]_[board].h : Platform configuration
  • board/[chipset]/[board]/include
    • cfg_main.h : Board configuration
    • cfg_gpio.h : GPIO driven
    • cfg_mem.h : System memory map

2.3.2 Linux configuration

  • arch/arm/plat-[chipset]/[board]
    • device.c : Platform device
  • arch/arm/plat-[chipset]/[board]/include
    • cfg_main.h : Board configuration
    • cfg_gpio.h : GPIO driven
    • cfg_mem.h : System memory map

 

3. Linux Source Download and Settings

3.1. Development Environment

  • Operating System Recommendations
    • Host OS : Ubuntu 14.04 LTS 64bit
    • HDD : More than 100GB
    • Memory : 16G
  • Minimum requirement
    • Host OS : Ubuntu 12.04 LTS 64bit
    • HDD : More than 20GB
    • Memory : 8G

 

3.2. Build Environment

3.2.1. Installing Linux Tools Package

  • Basic Build Tools
    • Ubuntu 12.04
      • $ sudo apt-get install git dkms build-essential ia32-libs vim libtool autoconf unrar libncurses5-dev python subversion u-boot-tools
    • Ubuntu 14.04
      • $ sudo apt-get install git dkms build-essential gcc-multilib vim libtool autoconf unrar libncurses5-dev python subversion u-boot-tools
  • NFS Server Tools
    • $ sudo apt-get install nfs-kernel-server
  • TFTP Server Tools
    • $ sudo apt-get install tftpd-hpa tftp-hpa
  • Internet Tools, Monitor Tools
    • $ sudo apt-get install lynx curl minicom

3.2.2. Download

After finished the previous section ” 3.2.1 Installing Linux Tools Package”, downloads the Linux BSP and set up the preference to build.

It can be easily installed as follows.

$ sudo apt-get install phablet-tools

If the installation failed, follow the guide below.

If you complete the installation, set the path

$ mkdir ~/bin
$ cd bin
$ curl http://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo

set path to .bashrc file.

$ vi .bashrc

export PATH=~/bin:$PATH

Apply the .bashrc

$ source .bashrc

Create the result directory.

$ mkdir –p LinuxBSP/result

The result direcroty is the temporary directory to copy the generated image.

Nexell’s Linux BSP can download by repo and git. Nexell Customer Support site notice the git url address and branch name.

$ cd LinuxBSP
LinuxBSP $ repo init -u git://git.nexell.co.kr/nexell/linux/manifest -b [Release branch name]

LinuxBSP $ repo sync
LinuxBSP $ ls
bootloader  kernel  platform  prototype

Cross Compiler Toolchain Set

Toolchain is platform/common/tools/crosstools/arm-cortex_a9-eabi-4.7-eglibc-2.18.tar.gz

LinuxBSP $ cd platform/common/tools/crosstools
crosstools $ sudo mkdir –p /opt/crosstools
crosstools $ sudo cp arm-cortex_a9-eabi-4.7-eglibc-2.18.tar.gz /opt/crosstools
crosstools $ cd /opt/crosstools
crosstools $ tar xvzf arm-cortex_a9-eabi-4.7-eglibc-2.18.tar.gz

Set the path as shown below.

crosstools $ vi ~/.bashrc

export PATH=$PATH:/opt/crosstools/arm-cortex_a9-eabi-4.7-eglibc-2.18/bin/

Apply .bashrc

$ source .bashrc

Build Environment Set

Set the path in the platform/[chipset]/build.env

LinuxBSP $ cd platform/<chipset>
LinuxBSP $ vi build.env

#########################################################################
# Embedded Linux Build Enviornment:
#########################################################################

OBJTREE                         := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))

ARCHNAME                   := S5P4418 (or S5P6818)
CROSSNAME                 := arm-cortex_a9-linux-gnueabi-

ARCHDIR                        := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
KERNDIR                        := $(ARCHDIR)/../../kernel/kernel-3.4.39

In the bootloader/u-boot-2014.07/board/[chipset]/[board]/config.mk

Set the CROSS_COMPILE.

[Note]

=> Please note the blank at end of sentence.

LinuxBSP $ vi bootloader/u-boot-2014.07/board/<chipset>/<board>/config.mk

# =====================================================================
#  Cross compiler
# =====================================================================
CROSS_COMPILE := arm-cortex_a9-linux-gnueabi-
… … …

kernel/kernel-3.4.39/arch/arm/configs/[chipset]_[board]_linux_defconfig

Set the CONFIG_CROSS_COMPILE.

LinuxBSP $ vi kernel/kernel-3.4.39/arch/arm/configs/<chipset>_<board>_linux_defconfig

# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=”arm-cortex_a9-linux-gnueabi-
… … ..

platform/<chipset>/modules/coda960/Makefile

Set the kernel path

LinuxBSP $ vi platform/<chipset>/modules/coda960/Makefile

TARGET                          = nx_vpu
KDIR                                := ../../../../kernel/kernel-3.4.39
#STRIP_CMD = arm-cortex_a9-linux-gnueabi-strip
obj-m                                := $(TARGET).o$
… … …

 

4. BSP Build

4.1. Build Script Function Menu

The following is one example of the execution screen build.sh.

********************************************************************

[Build Function Menu]

TOP Directory        : /home/work/LinuxBSP

Before Uboot        : [chipset]_[boardp_config

Before Kernel        : [chipset]_[board]_linux_defconfig

Board Name          : [board]

BOOT Device         : [boot device]

********************************************************************

1. ALL(+Compile)

1c. Clean Build

——————————————————————–

2. 2ndboot+u-boot+kernel(+Build)   2c. Clean Build(All)

21. u-boot(+Build)                               21c. u-boot(+Clean Build)

22. kernel(+Build)                                22c. kernel(+Clean Build)

23. 2ndboot(+Make)

24. partmap(+Make)

2m. kernel menuconfig

2mc. s5p4418_ktws_linux_defconfig -> .config

——————————————————————–

3. Application+Library(+Build)

3c. App+Lib(+Clean Build)

——————————————————————–

4. Buildroot(+Build)

4c. Buildroot(+Clean Build)

——————————————————————–

5. Filesystem(All)

51. Ramdisk(Root)(+Make)

52. Userdata(EXT4)(+Make)

——————————————————————–

6. eMMC Packaging(All)

61. fastboot partmap(partition map)

62. fastboot secondboot(2ndboot)

63. fastboot bootloader(u-boot)

64. fastboot boot(kernel)

65. fastboot system(rootfs ramdisk)

66. fastboot data(userdata)

66. fastboot reboot

——————————————————————–

7. Generate burning package

——————————————————————–

0. Exit

——————————————————————–

Select Menu ->

 

4.2. HowTo

How to use is as follows.

LinuxBSP$ ./platform/common/tools/build.sh [chipset] [board] [boot device]
  • chipset : s5p4418, s5p6818
  • board
    • s5p4418 : lepus/avn_ref/navi_ref/general
    • s5p6818 : avn_ref_bt/general
  • boot device : sdmmc, spi

 

4.2.1. All

  • 1 : All build
  • 1c : Clean build

 

4.2.2. 2ndboot + u-boot + kernel

  • 2 : u-boot, kernel build + 2ndboot make
  • 2c : Clean build
  • 21 : u-boot build
  • 21c : u-boot clean build
  • 22 : kernel build
  • 22c : kernel clean build
  • 23 : 2ndboot make
  • 2m : kernel menuconfig
  • 2mc : kernel config reconfiguration

 

4.2.3. Application + Library

  • 3 : App & lib build
  • 3c : Clean build

 

4.2.4. Buildroot

Buildroot platform for the ramdisk.

  • 4 : Buildroot build
  • 4c : Clean build

 

4.2.5. Filesystem

You can create a ramdisk and userdata file system.

  • 5 : Filesystem make
  • 51 : Rootfs type ramdisk make (ramdisk.gz)
  • 52 : EXT4 type userdata make (userdata.img)

 

4.2.6. eMMC Packaging

These are fastboot menu.

  • 6 : All built images writing & reboot
  • 61 : partmap writing
  • 62 : 2ndboot writing
  • 63 : U-boot writing
  • 64 : Kernel writing
  • 65 : Ramdisk writing
  • 66 : Userdata writing
  • 67 : Reboot

 

4.2.7. Generate burning package

  • 7 : Generate burning package

 

4.2.8. Exit

Finish the process.

  • 0 : Exit

 

5. USB Boot

5.1. USB boot (Windows PC)

  • NSIH : LinuxBSP\platform\[chipset]\boot\release\nsih\nsih_[board]_usb.txt
  • 2ndboot : LinuxBSP\platform\[chipset]\boot\release\2ndboot\2ndboot_[board]_usb.bin
  • u-boot : LinuxBSP\bootloader\u-boot-2014.07\u-boot.bin

Connect USB cable to board.

Check USB OK.

Click [Tx Second Boot] button.

Check USB OK -> NOK -> OK.

Click [Tx Image] button.

 

5.2. USB boot (Linux PC)

Connect the USB cable to the board and input the following.

LinuxBSP$ sudo platform/common/tools/bin/usb-downloader –t [chipset] \
-n platform/[chipset]/boot/release/nsih/nsih_[board]_usb.txt \
-b platform/[chipset]/boot/release/2ndboot/2ndboot_[board]_usb.bin
LinuxBSP$ sudo platform/common/tools/bin/usb-downloader –t [chipset] \
-f platform/bootloader/u-boot-2014.07/u-boot.bin