RPi2: Getting Smart on Tizen

This article is part of a series on Tizen on the Raspberry Pi 2.

Once you’ve got Tizen running on your Raspberry PI 2 (RPi2) using the procedures described in Tizen on RPi2: Now Supporting 3D Acceleration, you will probably want to be able to dynamically add/remove packages. It’s a pain to be required to rebuild and flash your OS every time you want to change the included software, so following this tutorial will help make this much easier. This small tutorial shows how to install the smart tool that is shipped on Tizen, but is not installed by default.

1) Add Smart to the RPi2 Image

The first step is to add the Smart Package Manager (python-smartpm) to the RPi2 Tizen image. This is the same package manager used on Yocto, and Tizen has its own patches for it.

In order to install it, you should apply the following simple patch on your Tizen repository:

--- a/meta-tizen/meta-tizen-common-base/recipes-image/images/tizen-core-image-minimal.bb
+++ b/meta-tizen/meta-tizen-common-base/recipes-image/images/tizen-core-image-minimal.bb
@@ -66,0 +67,2 @@ CORE_IMAGE_BASE_INSTALL += "gstreamer1.0-libav"
+# Package management
+CORE_IMAGE_BASE_INSTALL += "python-smartpm"

If you are unfamiliar with the patching process in linux, create a file that contains the above information, and use patch to apply the patch to: meta-tizen/meta-tizen-common-base/recipes-image/images/tizen-core-image-minimal.bb

Once patched, re-build the image as described on the previous tutorials and copy it to an SD card.

NOTE: You should replace /dev/sdz on the commands below and on the next sections of this article, in order to point to your specific disk that it is mapped. Otherwise you may damage your system!

As shown at Tizen on RPi2: Now Supporting 3D Acceleration, the build and install procedure is:

source ./tizen-common-init-build-env build
bitbake tizen-common-core-image-crosswalk-dev
dd if=tmp-glibc/deploy/images/raspberrypi2/tizen-common-core-image-crosswalk-dev.rpi-sdimg of=/dev/sdz bs=256M && sync

2) Resize the RPi2 Root Image to the Disk Size

By default, the RPi image size is minimal and does not fill the entire SD disk. We likely need to extend it to use all your SD card space, in order to have space to install new rpm packages on it.

Check the first sector number of the second partition of the disk, remember it, and use it to re-create the partition using the maximum sector number as the end of the partition.

In the example below, the first sector is 90112, and the last sector is 15564799. Delete partition 2 and make a new one from 90112 to 15564799. Note this is a slightly dangerous operation – you are deleting the sector with the important data on it. As long as you don’t do anything else in between it should be fine. The usual cautions about making sure which device’s partition table you are changing of course apply.

# fdisk /dev/sdz
Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p
Disk /dev/sdz: 7.4 GiB, 7969177600 bytes, 15564800 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000ceb8d

Device      Boot Start     End    Sectors   Size  Id Type
/dev/sdz1   *     8192   90111      81920    40M   c FAT32 W95 (LBA)
/dev/sdz2        90112 1810431    1720320   840M  83 Linux

Command (m for help): d
Partition number (1,2, default 2):

Partition 2 has been deleted.

Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2048-15564799, default 2048): 90112
Last sector, +sectors or +size{K,M,G,T,P} (90112-15564799, default 15564799):

Created a new partition 2 of type 'Linux' and of size 7.4 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Now, we’ll use the resize2fs command to extend the ext4 filesystem to fill the entire partition. Before that, the partition should be checked with e2fsck. Resize2fs may complain that you need to check again using “e2fsck -f”; if so, follow those instructions.

Those steps are shown below:

# e2fsck /dev/sdz2
e2fsck 1.42.12 (29-Aug-2014)
/dev/sdz2: clean, 16253/215040 files, 174308/215040 blocks
# resize2fs /dev/sdz2
resize2fs 1.42.12 (29-Aug-2014)
Resizing the filesystem on /dev/sdz2 to 1934336 (4k) blocks.
The filesystem on /dev/sdz2 is now 1933312 (4k) blocks long.

3) Put the rpm Files on a Web Server

After the bitbake build completes, you will find RPM packages in the directory build/tmp-glibc/deploy/rpm/. Copy the contents to your apache (or similar) web server root into a suitable directory (if you intend to use the same machine to do the builds and serve the packages, you can also make a symbolic link instead of copying).

The next step assumes that the server is at address 192.168.1.1 and that the files were copied under the rpm directory.

4) Add Smart Repositories to the RPi2 rootfs

Boot the RPi2 Tizen image, and log in as root (the default password is root). Then run the following command to create the package distribution channels on smart:

for i in all cortexa7t2hf_vfp_vfpv4_neon raspberrypi2; do smart channel --add $i type=rpm-md baseurl=http://192.168.1.1/rpm/$i; done

And update the channels with smart update:

# smart update
Loading cache...
Updating cache...        ############################### [100%]

Fetching information for 'all'...
-> http://192.168.1.1/rpm/all/repodata/repomd.xml                
repomd.xml               ############################### [ 16%]
-> http://192.168.1.1/rpm/all/repodata/primary.xml.gz
-> http://192.168.1.1/rpm/all/repodata/filelists.xml.gz
filelists.xml.gz         ############################### [ 25%]
primary.xml.gz           ############################### [ 33%]

Fetching information for 'cortexa7t2hf_vfp_vfpv4_neon'...
-> http://192.168.1.1/rpm/cortexa7t2hf_vfp_vfpv4_neon/repodata/repomd.xml
repomd.xml               ############################## [ 50%]
-> http://192.168.1.1/rpm/cortexa7t2hf_vfp_vfpv4_neon/repodata/primary.xml.gz
primary.xml.gz           ############################## [ 58%]
-> http://192.168.1.1/rpm/cortexa7t2hf_vfp_vfpv4_neon/repodata/filelists.xml.gz
filelists.xml.gz         ############################## [ 66%]

Fetching information for 'raspberrypi2'...
-> http://192.168.1.1/rpm/raspberrypi2/repodata/repomd.xml
repomd.xml               ############################## [ 83%]
-> http://192.168.1.1/rpm/raspberrypi2/repodata/primary.xml.gz
primary.xml.gz           ############################## [ 91%]
-> http://192.168.1.1/rpm/raspberrypi2/repodata/filelists.xml.gz
filelists.xml.gz         ############################## [100%]

Updating cache...        ############################## [100%]

Channels have 5310 new packages.
Saving cache...

5) Install Packages on RPi2!

Now, installing a new package is no more complicated than this simple command:

# smart install crosswalk-thirdparty
Loading cache...
Updating cache...  #################################### [100%]
Computing transaction...
Installing packages (1):
 crosswalk-thirdparty-11.40.277.0-r0@cortexa7t2hf_vfp_vfpv4_neon
917.7MB of package files are needed. 932.1MB will be used.
Confirm changes? (Y/n): y

Fetching packages...
-> http://192.168.1.1/rpm/cortexa7t2hf_vfp_vfpv4_neon/crosswalk-thirdparty-11.40.277.0-r0.cortexa7t2hf_vfp_vfpv4_neon.rpm
crosswalk-thirdparty-11.40.277.0-r0.cortexa7t2hf_vfp_vfpv4_neon.rpm           ########## [100%]

Committing transaction...
Preparing...                                 ########## [  0%]
   1:Installing crosswalk-thirdparty         ########## [100%]

Once you’ve successfully completed these steps, you should be able to install new versions of packages as they are developed without being required to flash your device every time. This seemingly minor change should help save time for anyone trying to build things for Tizen on the RPi2.

Get Involved

If you want to learn more or get involved, you can join us in the Tizen IRC chatroom, or subscribe to the Tizen Community mailing list. Lastly, you can also stay tuned to this blog to catch more articles about building things on Tizen and Raspberry Pi.

Have fun!

Raspberry Pi is a trademark of the Raspberry Pi Foundation

Author: Mauro Carvalho Chehab

Mauro is the maintainer of the Linux kernel media and EDAC subsystems and Tizen on Yocto. He's also a major contributor to the Reliability Availability and Serviceability (RAS) subsystems.

3 thoughts on “RPi2: Getting Smart on Tizen”

  1. HI! Very good article.
    I was trying to bitbake the RPi2 image, but it’s returning an error message:

    | Makefile:1682: recipe for target ‘../obj_s/lib_gen.o’ failed
    | make[1]: *** [../obj_s/lib_gen.o] Error 1
    | make[1]: *** Waiting for unfinished jobs….
    | /home/aideguchi/Tizen/tizen-distro/build/tmp-glibc/work/x86_64-linux/ncurses-native/5.9-r15.1/ncurses-5.9/ncurses/base/lib_mouse.c:1533:1: error: expected identifier or ‘(‘ before ‘{‘ token
    | {
    | ^
    | Makefile:1736: recipe for target ‘../obj_s/lib_mouse.o’ failed
    | make[1]: *** [../obj_s/lib_mouse.o] Error 1
    | make[1]: Leaving directory ‘/home/aideguchi/Tizen/tizen-distro/build/tmp-glibc/work/x86_64-linux/ncurses-native/5.9-r15.1/build/narrowc/ncurses’
    | Makefile:134: recipe for target ‘libs’ failed
    | make: *** [libs] Error 2
    | make: Leaving directory ‘/home/aideguchi/Tizen/tizen-distro/build/tmp-glibc/work/x86_64-linux/ncurses-native/5.9-r15.1/build/narrowc’
    | ERROR: oe_runmake failed
    | WARNING: /home/aideguchi/Tizen/tizen-distro/build/tmp-glibc/work/x86_64-linux/ncurses-native/5.9-r15.1/temp/run.do_compile.25892:1 exit 1 from
    | exit 1
    | ERROR: Function failed: do_compile (log file is located at /home/aideguchi/Tizen/tizen-distro/build/tmp-glibc/work/x86_64-linux/ncurses-native/5.9-r15.1/temp/log.do_compile.25892)
    ERROR: Task 927 (virtual:native:/home/aideguchi/Tizen/tizen-distro/meta/recipes-core/ncurses/ncurses_5.9.bb, do_compile) failed with exit code ‘1’

    Any idea on how to solve this?
    Thansk a lot!

  2. This problem is caused by building with gcc 5.x, which doesn’t entirely work yet. Patches exist for some of the build problems (including the ncurses one which is the “first failure”), but not for all of them. If possible, try to use a build host with a gcc 4 version on it, things will just go more smoothly for now.

Comments are closed.