DM8148 Z3 MACHINE - andreimironenko/oe-davinci GitHub Wiki
Z3 build system is not ideal, it consists of recursive make files. In most cases not structured. Under build-tools directory, you can find z3_appconfig and some scripts files. The configuration file defines some flags (as for instance memory size), components to include. Not all the components are configured in the z3_appconfig, the main Makefile looks for some directories, if the directory exists it will build the component.
To ease the build process, Z3 provides makeall.sh file which will do all the job you need but be careful. Each time this script it's invoked it cleans up the results of previous build. I suggest you to comment out these two lines in this script:
#make -C filesys distclean #make clean
Please install these packages prior to the build:
$ sudo apt-get install bison flex mtd-utils liblzo2-dev uuid-dev zlib1g-dev $ sudo apt-get install libpcre3-dev autoconf autoconf-archive automake $ sudo apt-get install automake1.9 automake1.9-doc libtool libtool-doc
OE pre-requisites:
$ sudo apt-get install diffstat $ sudo apt-get install texi2html $ sudo apt-get install makeinfo $ sudo apt-get install chrpath $ sudo apt-get install texi2html $ sudo apt-get install texinfo
As I already mentioned ealry. To build Z3 software you need to run:
./makeall.sh
After successful build you should see under the images folder the following items:
centaurus-img-mfr.cfg u-boot u-boot-uartboot.bin centaurus-img-upd.cfg u-boot.bin uImage filesys_archive_2012-07-31.tar.gz u-boot.bin.img z3-centaurus-mfr.img fs u-boot-env-pcie.scr z3-centaurus-upd.img mk-z3-img u-boot-env.scr ubifs-image u-boot.stage1.img
Login to amuxi, server with your windows credentials
$ ssh amironenko@amuxi
where amironenko - my network login.
Then create a personal build folder under common build directory /usr/share/build
$ mkdir /usr/share/build/amironenko
Change directory to this folder
$ cd /usr/share/build/amironenko
First of all, create a new directory, I recommend to follow a convention and name it "oe"
$ mkdir oe
step there
$ cd oe
Create a symlink to distributives which are under the /usr/share/build/downloads
$ ln -s ../../downloads/
Get OE components from amuxi Git server. Run these commands below:
$ git clone git@amuxi:/opt/git/oe/arago-dm81xx.git arago
$ git clone git@amuxi:/opt/git/oe/arago-bitbake.git
$ git clone git@amuxi:/opt/git/oe/arago-oe-dev.git
$ git clone git@amuxi:/opt/git/oe/hanover-system.git
$ git clone git@amuxi:/opt/git/oe/hanover-apps.git
Before starting the build, source the setenv to set up required OE environment variables:
$ source arago/setenv
at this stage we are ready to start the build process, just issue this simple command:
$ MACHINE=dm814x-z3 bitbake hanover-fb-image
it will take some hours and a lot of CPU power but once it's finished you can find the rootfs image, modules and kernel image under this directory
arago-tmp/deploy/eglibc/images/dm814x-z3
the generated images should look similar to these:
hanover-fb-image-eglibc-ipk-2011.09-dm814x-z3.rootfs.tar.gz modules-2.6.37-psp04.04.00.01-r1-dm814x-z3.tgz uImage-2.6.37-psp04.04.00.01-r1-dm814x-z3.bin
untar the images to the export root filesystem folder, copy uImage-2.6.37-psp04.04.00.01-r1-dm814x-z3.bin to boot/uImage.
The following features are required to be enabled in the kernel configuration:
- NFS client/server;
- FTDI usb-to-serial;
- Framebuffer console;
Ubuntu
The following packages must be installed:
$ sudo apt-get install minicom $ sudo apt-get install ckermit
Windows
File:Z3 J20 jumpers configuration.jpg
$ sudo mkfs.ubifs -r rootfs/ -o ubifs.img -m 2048 -e 124KiB -c 1601
[ubifs] mode=ubi image=ubifs.img vol_id=0 vol_size=192MiB vol_type=dynamic vol_name=rootfs vol_flags=autoresize
$ ubinize -o ubi.img -m 2048 -p 128KiB -s 512 -O 2048 ubinize.cfg
List all MTD partitions which available in the system:
$ ls /dev/mtd* /dev/mtd0 /dev/mtd3 /dev/mtd6 /dev/mtdblock2 /dev/mtd0ro /dev/mtd3ro /dev/mtd6ro /dev/mtdblock3 /dev/mtd1 /dev/mtd4 /dev/mtd7 /dev/mtdblock4 /dev/mtd1ro /dev/mtd4ro /dev/mtd7ro /dev/mtdblock5 /dev/mtd2 /dev/mtd5 /dev/mtdblock0 /dev/mtdblock6 /dev/mtd2ro /dev/mtd5ro /dev/mtdblock1 /dev/mtdblock7
Go through all /dev/mtdX devices and list info
$ mtdinfo /dev/mtd6 mtd6 Name: File System Type: nand Eraseblock size: 131072 bytes, 128.0 KiB Amount of eraseblocks: 1601 (209846272 bytes, 200.1 MiB) Minimum input/output unit size: 2048 bytes Sub-page size: 512 bytes OOB size: 64 bytes Character device major/minor: 90:12 Bad blocks are allowed: true Device is writable: true
In my case, /dev/mtd6 is MTD partition is being assigned to root file system, and it's 200.1 MiB.
To write u-boot.min, u-boot.bin and default.scr to NAND you can use this commands
flash_erase /dev/mtd1 0 0 nandwrite -p /dev/mtd1 u-boot.bin
where /dev/mtd1 is NAND partition assigned to u-boot.bin.
To write generated ubi.img to this paratition use this command
$ ubiformat /dev/mtd6 -f ubi.img -s 512 -O 2048
Notice that -s option specifies the sub-page size, accordingly mtdinfo it's 512 bytes.
U-boot UBIFS settings:
setenv mtdids 'nand0=nand' setenv mtdparts 'mtdparts=nand:128k(u-boot-min)ro,1920k(u-boot),512k(environment),4352k(kernel),204928k(rootfs)'
Z3-DM8148# chpart rootfs partition changed to nand0,4
Z3-DM8148# ubi part rootfs 2048 Creating 1 MTD partitions on "nand0": 0x0000006c0000-0x00000cee0000 : "mtd=4" UBI: attaching mtd1 to ubi0 UBI: physical eraseblock size: 131072 bytes (128 KiB) UBI: logical eraseblock size: 126976 bytes UBI: smallest flash I/O unit: 2048 UBI: sub-page size: 512 UBI: VID header offset: 2048 (aligned 2048) UBI: data offset: 4096 UBI warning: ubi_eba_init_scan: cannot reserve enough PEBs for bad PEB handling, reserved 11, need 16 UBI: attached mtd1 to ubi0 UBI: MTD device name: "mtd=4" UBI: MTD device size: 200 MiB UBI: number of good PEBs: 1601 UBI: number of bad PEBs: 0 UBI: max. allowed volumes: 128 UBI: wear-leveling threshold: 4096 UBI: number of internal volumes: 1 UBI: number of user volumes: 1 UBI: available PEBs: 0 UBI: total number of reserved PEBs: 1601 UBI: number of PEBs reserved for bad PEB handling: 11 UBI: max/mean erase counter: 1/0
Z3-DM8148# ubifsmount rootfs UBIFS: mounted UBI device 0, volume 0, name "rootfs" UBIFS: mounted read-only UBIFS: file system size: 199987200 bytes (195300 KiB, 190 MiB, 1575 LEBs) UBIFS: journal size: 9023488 bytes (8812 KiB, 8 MiB, 72 LEBs) UBIFS: media format: w4/r0 (latest is w4/r0) UBIFS: default compressor: LZO UBIFS: reserved for root: 0 bytes (0 KiB)
Z3-DM8148# ubifsls <DIR> 5216 Wed Jan 23 16:38:00 2013 bin <DIR> 4896 Wed Jan 02 13:54:00 2013 dev <DIR> 4048 Wed Jan 23 16:38:00 2013 etc <DIR> 2632 Wed Jan 23 15:41:33 2013 lib <DIR> 416 Wed Jan 23 16:37:47 2013 mnt <DIR> 224 Wed Jan 23 16:37:49 2013 srv <DIR> 160 Wed Jan 02 13:54:00 2013 tmp <DIR> 160 Wed Jan 02 13:54:00 2013 sys <DIR> 808 Tue Dec 11 21:43:30 2012 var <DIR> 672 Wed Jan 02 13:53:33 2013 usr <DIR> 224 Wed Jan 23 21:26:24 2013 boot <DIR> 224 Wed Jan 23 16:37:47 2013 home <DIR> 160 Wed Jan 02 13:54:00 2013 proc <DIR> 9112 Wed Jan 23 16:38:00 2013 sbin <LNK> 12 Wed Jan 23 16:37:55 2013 linuxrc <DIR> 680 Wed Jan 23 16:37:47 2013 media
Z3-DM8148# ubifsload ${loadaddr} boot/uImage Loading file 'boot/uImage' to addr 0x81800000 with size 2717540 (0x00297764)... Done
ubi part rootfs 2048
setenv machid 'cbd' //Z3_MACHID=3261
Setting-up IP with DHCP
U-Boot> setenv autoload no U-Boot> dhcp
Mount UBIFS in Linux
$ ubiattach /dev/ubi_ctrl -m 4 $ mkdir /mnt/ubifs $ mount -t ubifs /dev/ubi0_0 /mnt/ubifs UBIFS: mounted UBI device 0, volume 0, name "rootfs" UBIFS: file system size: 199987200 bytes (195300 KiB, 190 MiB, 1575 LEBs) UBIFS: journal size: 9023488 bytes (8812 KiB, 8 MiB, 72 LEBs) UBIFS: media format: w4/r0 (latest is w4/r0) UBIFS: default compressor: lzo UBIFS: reserved for root: 0 bytes (0 KiB)
DM814x AM387x PSP U-Boot/U-Boot-MIN
Loading 2nd stage U-boot over UART
Booting Linux kernel using U-Boot
Why NFS boot? At the moment there are two ways for booting Z3:
- Booting from NAND;
- Booting from network - NFS;
Adding the sequences below to issue/issue.net files will set console blank property to 0:
$ echo -n -e "\033[9;0]" >> /etc/issue $ echo -n -e "\033[9;0]" >> /etc/issue.net
It can be then checked
$ cat /sys/module/kernel/parameters/consoleblank
Shell script ssh password provied
Install these packages
# sudo apt-get install nfs-kernel-server # sudo apt-get install nfs-common
I recommend to create "exports" folder. Add this line to /etc/exports:
/opt/exports *(rw,no_root_squash,no_all_squash,insecure,no_subtree_check)
I recommend to create "rootfs" sub-folder under /opt/exports. Copy the built filesystem from images/fs to /opt/exports/rootfs. Use this command:
# sudo rsync -av images/fs/* /opt/exports/rootfs
Two sym-links need to be updated. Go to /etc/rc5.d. Run these two commands:
# ln -sf ../../opt/z3/init_7611_edid.sh S98z3.sh # ln -sf ../../opt/webgui/S99webserver.sh
Make sure you followed these steps to install your local sub-network. I strongly recommend this because there is shortage of the IP-addresses in the HANOVER network and you might have a problem connecting Z3 board.
Each Z3 board delivered with pre-installed u-boot loader. To configure u-boot, connect the board via serial cable to the host PC and start the terminal. Switch on the board and hold space, u-boot should go to the prompt.
Copy and paste these lines one by one.
setenv ipaddr '10.42.43.85' setenv gatewayip '10.42.43.1' setenv netmask '255.255.255.0' setenv serverip '10.42.43.1' setenv nfsserver '10.42.43.1' setenv saved_serverip '10.42.43.1' setenv nfs_root '/home/amironenko/exports/rootfs'
setenv bootargs_nfs_misc 'mem=176M earlyprintk'
setenv bootargs_nfs_only setenv bootargs 'console=${console} noinitrd root=/dev/nfs nfsroot=${nfsserver}:${nfs_root},nolock rw ${bootargs_nfs_misc}: ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}'
As you might notice, in my case 10.42.43.85 - Z3 board IP-address, 10.42.43.1 - my Ubuntu host.
Then copy and paste the line bellow as well. System should start the boot automatically. You need to copy this line each time you boot.
setenv boot_nfs_only 'echo Boot from NAND and NFS...; run setpower set-ip bootargs_nfs_only; nfs ${loadaddr} ${serverip}:${nfs_root}/boot/${bootfile}; bootm ${loadaddr}'
Save the configuration for the next boot:
saveenv
Next time you reboot, the system should start booting from NFS.
Accessing U-boot configuration from Linux
To get access to the u-boot environment from Linux, add these lines to /etc/fw_env.config:
# MTD device Offset Env.Size Sector.Size /dev/mtd2 0x00000 0x8000 0x20000
To print all environment variables:
$ fw_printenv
print out the certain variable value
stderr=serial
updating variable value
$ fw_setenv stderr netconsole $ fw_printenv stderr stderr=netconsole
If you followed the steps described above your Z3 should be connected to the internet already. To enable opkg (pakage management) feature we just need to add one line to the /etc/opkg/opkg.conf
Insert this line at the bottom of this file:
src angstrom_base http://www.angstrom-distribution.org/feeds/2011.03/ipk/glibc/armv5te/base
then run
$ opkg update
and try to install vim for instance
$ opkg install vim
The vim should be installed.
A simple Windows client can be download from here.
VIC code mapping incorrectly in hdmi.c
Instructions how to create RAMFS image
Gstreamer pipeline examples for DM814x and DM816x
If you decide to install fbida (JPEG viewer) then you need to install this package ttf-dejavu-sans-mono with required fonts.
Available i2c devices:
i2c:1-0050 i2c:1-0023 i2c:1-0018 i2c:1-0020 i2c:1-0040 i2c:1-0021 i2c:1-004a i2c:1-002d i2c:3-0018 i2c:3-0021