How to get the Poky Linux distribution

Revision as of 13:08, 25 January 2011 by Eballetbo (talk | contribs) (CAN)

Revision as of 13:08, 25 January 2011 by Eballetbo (talk | contribs) (CAN)

Contents

How to get the Poky Linux distribution

Poky is an open source platform build tool. It is a complete software development environment for the creation of Linux devices. It enables you to design, develop, build, debug, and test a complete, modern, software stack using Linux, the X Window System and GNOME Mobile based application frameworks for both x86 and ARM based platforms. Key features include:

  • Full, fast, cross device filesystem creation with Linux Kernel 2.6.x, GCC, GNU C library, Busybox, networking and much more.
  • Highly configurable and extendable with full documentation, granular feature control, packaging, and wide machine coverage.
  • Developer friendly with QEMU device virtulisation, SDK generation, Anjuta IDE, OProfile and GDB integration.
  • Complete GNOME Mobile platform with the X Window System, Matchbox, GTK+ 2.12, D-Bus, GStreamer and 'Sato' reference implementation.
  • Support for bleeding edge OpenGL user interfaces with the Clutter toolkit.
  • A supported, stable and proven base for real world products built on Linux and open source software.

Overview of How-To

This How-To is meant to be a starting point for people to learn build and run Poky images for IGEP v2 devices as quickly and easily as possible.

This How-To works with the Ubuntu 8.04 IGEP v2.0 SDK Virtual Machine but most of the contents are valid also for other GNU/Linux distributions. We do not issue any guarantee that this will work on other distributions.

This How-To will start out by a Poky Platform Setup Environment introducing you to the Poky environment and the way you can build an Poky-based image.

Next, we will cover the Poky images supported.

Lastly, we will learn how to Installing and Using the Result on a NFS-mounted root filesystem.

Requirements

  • Ubuntu 8.04 IGEP v2.0 SDK Virtual Machine

Feedback and Contributing

At any point, if you see a mistake you can contribute to this How-To.

How to get involved (http://pokylinux.org/support/)

There are many ways to get involved with the Poky project. Poky has a friendly community providing informal support and discussion.

Mailing list

To subscribe send mail to;

poky+subscribe <at> openedhand <dot> com

And follow simple instructions in subsequent reply. Archives are available here.

Bugs

Problems with Poky should be reported in the bug tracker: http://bugzilla.o-hand.com/

IRC

Chat with the Poky development team and community in #poky on freenode.

References

Much of this How-To is extracted from different sources. If you would like to read some of the original articles or resources, please visit them and thank the authors:

Poky Platform Setup Environment

Poky is derivative of the Open Embedded. In order to function properly, the Virtual Machine need some adaptations of the development system.

The first thing we need to do is set Bash as default sh shell, execute

$ sudo dpkg-reconfigure dash

and answer no when asked whether you want to install dash as /bin/sh. So, now, "/bin/sh" file links to "/bin/bash" (not to "/bin/dash").

An other change we need to perform is to change some default settings of the kernel. Edit the /etc/sysctl.conf file as root with your preferred editor and set the vm.mmpap_min_addr to 0

$ sudo nano /etc/sysctl.conf
vm.mmap_min_addr = 0

then, run this command

$ sudo sysctl -p

Install extra packages necessary for bitbake to function.

$ sudo apt-get update
$ sudo aptitude install subversion cvs git-core \
       build-essential help2man diffstat texi2html texinfo \
       libncurses5-dev gawk python-dev python-psyco python-pysqlite2 \
       scrollkeeper gnome-doc-utils gettext automake mercurial libx11-dev \
       libgl1-mesa-dev libglu1-mesa-dev libsdl1.2-dev

Poky version 3.2 codename Purple (stable branch)

Poky version 3.2 ( stable branch) is available from a GIT repository located at git://git.igep.es/pub/scm/poky.git. The first thing you will do is clone the Poky project.

$ git clone git://git.igep.es/pub/scm/poky.git
Initialized empty Git repository in /home/eballetbo/Software/staging/poky/.git/
remote: Counting objects: 52944, done.
remote: Compressing objects: 100% (16209/16209), done.
remote: Total 52944 (delta 34820), reused 52910 (delta 34806)
Receiving objects: 100% (52944/52944), 35.52 MiB | 249 KiB/s, done.
Resolving deltas: 100% (34820/34820), done.

Then, switch to stable branch (Purple v3.2)

$ cd poky
$ git checkout origin/release/purple -b release/purple
warning: You appear to be on a branch yet to be born.
warning: Forcing checkout of origin/release/purple.
Branch release/purple set up to track remote branch refs/remotes/origin/release/purple.
Switched to a new branch "release/purple"

After that, you need to link an user board configuration (local.conf). The configuration file who defines various configuration variables which govern what Poky platform does.

$ ln -s ../../meta-contrib/build/conf/local.conf.igep0020 build/conf/local.conf

At this point the Poky build environment needs to be set up, you will do this with the poky-init-build-env script. Sourcing this file in a shell makes changes to PATH and sets other core bitbake variables based on the current working directory.

Refer to http://www.pokylinux.org/doc/poky-handbook.html#ref-images for standard images

Refer to Ubuntu 8.04 IGEP v2.0 SDK Virtual Machine to how to install and use poky images on a NFS-mounted root filesystem.

Poky version 3.3 codename Green (under development)

Note: This is currently work in progress Use ONLY for testing and development purposes.

The Poky handbook guides users through getting started with Poky and explains how the build system components fit together and interact. The setup and use of the SDK is also covered along with other common development tasks such as debugging and profiling applications. It also contains extensive reference material on many other aspects of Poky such as the classes, variables and other technical details.

A customized Poky version 3.3 for IGEP platforms is available from a GIT repository located at git://git.igep.es/pub/scm/poky.git.

The first thing you will do is clone the Poky project.

$ git clone git://git.igep.es/pub/scm/poky.git
$ cd poky

At this point the Poky build environment needs to be set up, you will do this with the poky-init-build-env script. Sourcing this file in a shell makes changes to PATH and sets other core bitbake variables based on the current working directory.

$ source poky-init-build-env
$ bitbake poky-image-sato

Notes, tips and tricks for the new demo image

Change default bootargs
fw_setenv bootargs-base 'mem=506M console=ttyS2,115200n8 console=tty0 omapfb.mode=dvi:1024x768MR-32@60 omapfb.vram=0:8M,1:4M'
Bring up eth0
udhcpc -i eth0
ALSA active the headset path
amixer set -D hw:0 'Headset' 6dB
amixer set -D hw:0 'HeadsetL Mixer AudioL2' on
amixer set -D hw:0 'HeadsetR Mixer AudioR2' on
SGX Video Acceleration

You can test the SGX with a DEMO, grab and untar the SDK Demo Package

wget http://neuvoo.org/neuvoo/distfiles/SGX-3.01.00.07-SDK.tar.gz
tar xzf SGX-3.01.00.07-SDK.tar.gz

Then to run the demos just get into the X11 Binaries directory (e.g. OGLES/SDKPackage/Binaries/CommonX11/Demos/EvilSkull) and run the demo:

./OGLESEvilSkull
DSP using dspbridge
fw_setenv bootargs-base 'mem=506M console=ttyS2,115200n8 console=tty0 omapfb.mode=dvi:1024x768MR-32@60 omapfb.vram=0:8M,1:4M'
wget http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_surround-fix.avi
modprobe mailbox_mach
modprobe bridgedriver base_img=/lib/dsp/baseimage.dof phys_mempool_base=0x9FA00000
DISPLAY=:0 gst-launch -v playbin uri=file:/home/root/big-buck-bunny-480p-surround.avi
TFT and Touchscreen

Seiko 7.0 inch WVGA (800 x RGB x 480) TFT:

fw_setenv bootargs-base 'console=ttyS2,115200n8 console=tty0 omapdss.def_disp=lcd-70 omapfb.mode=dvi:1024x768MR-32@60'

Powertip 4.3 inch (480 x RGB x 272) TFT:

fw_setenv bootargs-base 'console=ttyS2,115200n8 console=tty0 omapdss.def_disp=lcd-43 omapfb.mode=dvi:1024x768MR-32@60'

DVI output:

fw_setenv bootargs-base 'console=ttyS2,115200n8 console=tty0 omapdss.def_disp=dvi omapfb.mode=dvi:1024x768MR-32@60'

Edit the InputDevice section in your xorg.conf

cat >> /etc/X11/xorg.conf << EOF
Section "InputDevice"
       Identifier      "Configured Touchscreen"
       Driver          "tslib"
       Option          "CorePointer"           "true"
       Option          "SendCoreEvents"        "true"
       Option          "Device"                "/dev/input/touchscreen0"
       Option          "Protocol"              "Auto"
EndSection
EOF

Add "Configured Touchscreen" in "ServerLayout" section and remove "Configured Mouse"

Section "ServerLayout"
   Identifier    "Default Layout"
   Screen        "Default Screen"
   InputDevice    "Generic Keyboard"
#   InputDevice    "Configured Mouse"
   InputDevice    "Configured Touchscreen"
   Option         "AllowEmptyInput" "no"
EndSection

Edit /etc/formfactor/machconfig like this

HAVE_TOUCHSCREEN=1
HAVE_KEYBOARD=0

calibrate your touchscreen

for Powertip 4.3 inch (480 x RGB x 272) TFT:

echo -n "8407 -476 -31410144 3 -4861 38051952 655366" > /etc/pointercal

for Seiko 7.0 inch WVGA (800 x RGB x 480) TFT:

echo -n "13714 0 -56041568 1 -8076 63332096 6553665536" > /etc/pointercal

or calibrate it yourself until you are happy with the result, for example:

 /etc/init.d/xserver-nodm stop

 TSLIB_CALIBFILE=/etc/pointercal TSLIB_TSDEVICE=/dev/input/touchscreen0 TSLIB_CONSOLEDEVICE=none ts_calibrate

 /etc/init.d/xserver-nodm start
Modem
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index e633c01..3778990 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -57,7 +57,7 @@ static const u8 twl4030_reg[TWL4030_CACHEREGNUM] = {
 	0x00, /* REG_AVTXL2PGA		(0xC)	*/
 	0x00, /* REG_AVTXR2PGA		(0xD)	*/
 	0x00, /* REG_AUDIO_IF		(0xE)	*/
-	0x00, /* REG_VOICE_IF		(0xF)	*/
+	0x04, /* REG_VOICE_IF		(0xF)	*/
 	0x00, /* REG_ARXR1PGA		(0x10)	*/
 	0x00, /* REG_ARXL1PGA		(0x11)	*/
 	0x6c, /* REG_ARXR2PGA		(0x12)	*/
CAN

Several tools are provided by socketCAN:

  • candump: dump traffic on a CAN network
  • cansend: simple command line tool to send CAN-frames via CAN_RAW sockets
  • cangen: CAN frames generator for testing purpose
  • canplayer: send CAN frames from a file to a CAN interface
/sbin/ip link set can0 up type can bitrate 125000

On the receiver side:

candump can0

On the sender side:

cansend can0 123#AABBCCDD
cansend can0 123#R 
cansend can0 1F334455#1122334455667788
cansend can0 1F334455#R

On the receiver side, you must see the following messages:

can0  123  [4] AA BB CC DD
can0  123  [0] remote request
can0  1F334455  [8] 11 22 33 44 55 66 77 88
can0  1F334455  [0] remote request

Switch roles and do again

TVP5151
Kernel
git clone git://linuxtv.org/pinchartl/media.git
git checkout -b origin/media-0005-sensors media-0005-sensors
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- omap2plus_defconfig
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig

Select "Device Drivers->Multimedia support" (CONFIG_MEDIA_SUPPORT) and enter to the submenu.

--- Multimedia support
*** Multimedia core support ***
[*]   Media Controller API (EXPERIMENTAL)
<*>   Video For Linux
[*]     Enable Video For Linux API 1 (DEPRECATED) (NEW)
[*]     V4L2 sub-device userspace API (EXPERIMENTAL)
[*]   Video capture adapters  --->
    --- Video capture adapters 
    <*>   OMAP 3 Camera support (EXPERIMENTAL)
    [*]     OMAP 3 Camera debug messages 
    Encoders/decoders and other helper chips  --->
        <*> Texas Instruments TVP5150 video decoder
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage modules

Note: Building OMAP 3 Camera support as module fails with error

ERROR: "omap_pm_set_min_bus_tput" [drivers/media/video/isp/omap3-isp.ko] undefined!
Helper: media-ctl
git clone git://git.ideasonboard.org/media-ctl.git
git checkout origin/new-api -b new-api
make CROSS_COMPILE=arm-none-linux-gnueabi- KDIR=<kernel include dir>
./media-ctl -p
cat /sys/devices/platform/omap3isp/video4linux/v4l-subdev2/name; cat /sys/devices/platform/omap3isp/video4linux/v4l-subdev2/dev
OMAP3 ISP CCDC
81:4
mknod /dev/v4l-subdev2 c 81 4
cat /sys/devices/platform/omap3isp/video4linux/v4l-subdev8/name; cat /sys/devices/platform/omap3isp/video4linux/v4l-subdev8/dev
tvp5150 2-005c
81:15
mknod /dev/v4l-subdev8 c 81 15
mknod /dev/video2 c 81 5
./media-ctl -r -l '"tvp5150 2-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
 gst-launch v4l2src device=/dev/video2 ! ffmpegcolorspace ! fakesink
Patches
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 5892766..af2ebe7 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -8,10 +8,13 @@
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <linux/videodev2.h>
+#include <linux/v4l2-mediabus.h>
 #include <linux/delay.h>
+#include <media/v4l2-chip-ident.h>
+#include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
+#include <media/v4l2-subdev.h>
 #include <media/tvp5150.h>
-#include <media/v4l2-chip-ident.h>
 
 #include "tvp5150_reg.h"
 
@@ -67,6 +70,7 @@ static struct v4l2_queryctrl tvp5150_qctrl[] = {
 
 struct tvp5150 {
 	struct v4l2_subdev sd;
+	struct media_pad pad;
 
 	v4l2_std_id norm;	/* Current set standard */
 	u32 input;
@@ -1059,6 +1063,7 @@ static int tvp5150_probe(struct i2c_client *c,
 {
 	struct tvp5150 *core;
 	struct v4l2_subdev *sd;
+	int ret;
 
 	/* Check if the adapter supports the needed features */
 	if (!i2c_check_functionality(c->adapter,
@@ -1071,6 +1076,8 @@ static int tvp5150_probe(struct i2c_client *c,
 	}
 	sd = &core->sd;
 	v4l2_i2c_subdev_init(sd, c, &tvp5150_ops);
+	core->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+
 	v4l_info(c, "chip found @ 0x%02x (%s)\n",
 		 c->addr << 1, c->adapter->name);
 
@@ -1084,7 +1091,13 @@ static int tvp5150_probe(struct i2c_client *c,
 
 	if (debug > 1)
 		tvp5150_log_status(sd);
-	return 0;
+
+	core->pad.flags = MEDIA_PAD_FLAG_OUTPUT;
+	ret = media_entity_init(&core->sd.entity, 1, &core->pad, 0);
+	if (ret < 0)
+		kfree(core);
+
+	return ret;
 }
 
 static int tvp5150_remove(struct i2c_client *c)
@@ -1096,6 +1109,7 @@ static int tvp5150_remove(struct i2c_client *c)
 		c->addr << 1);
 
 	v4l2_device_unregister_subdev(sd);
+	media_entity_cleanup(&sd->entity);
 	kfree(to_tvp5150(sd));
 	return 0;
 }
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 5e035a5..ea7e082 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -32,6 +32,7 @@
 #include <plat/display.h>
 #include <plat/onenand.h>
 
+#include "devices.h"
 #include "mux.h"
 #include "hsmmc.h"
 #include "sdram-numonyx-m65kxxxxam.h"
@@ -546,6 +547,10 @@ static void __init igep2_i2c_init(void)
 	if (ret)
 		pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret);
 
+	ret = omap_register_i2c_bus(2, 400, NULL, 0);
+	if (ret)
+		pr_warning("IGEP2: Could not register I2C2 bus (%d)\n", ret);
+
 	/*
 	 * Bus 3 is attached to the DVI port where devices like the pico DLP
 	 * projector don't work reliably with 400kHz
@@ -625,6 +630,44 @@ static void __init igep2_wlan_bt_init(void)
 static inline void __init igep2_wlan_bt_init(void) { }
 #endif
 
+#include <linux/videodev2.h>
+
+#include "../../../drivers/media/video/isp/isp.h"
+#include "../../../drivers/media/video/isp/ispreg.h"
+
+static struct i2c_board_info igep0022_camera_i2c_devices[] = {
+	{
+		I2C_BOARD_INFO("tvp5150", (0xb8 >> 1)),
+		/* .platform_data = &rx51_et8ek8_platform_data, */
+	},
+};
+
+static struct isp_subdev_i2c_board_info igep0022_camera_primary_subdevs[] = {
+	{
+		.board_info = &igep0022_camera_i2c_devices[0],
+		.i2c_adapter_id = 2,
+	},
+	{ NULL, 0, },
+};
+
+static struct isp_v4l2_subdevs_group igep0022_camera_subdevs[] = {
+	{
+        	.subdevs = igep0022_camera_primary_subdevs,
+                .interface = ISP_INTERFACE_PARALLEL,
+                .bus = { .parallel = {
+                		.width			= 8,
+                		.data_lane_shift	= 0,
+                		.clk_pol		= 0,
+                		.bridge		= ISPCTRL_PAR_BRIDGE_DISABLE,
+                } },
+	},
+	{ NULL, 0, },
+};
+
+static struct isp_platform_data igep0022_isp_pdata = {
+        .subdevs = igep0022_camera_subdevs,
+};
+
 static void __init igep2_init(void)
 {
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
@@ -649,6 +692,9 @@ static void __init igep2_init(void)
 	 */
 	igep2_wlan_bt_init();
 
+	/* Camera interface */
+	if (omap3_init_camera(&igep0022_isp_pdata) < 0)
+		pr_warning("IGEP2: Unable to register camera platform \n");
 }
 
 MACHINE_START(IGEP0020, "IGEP v2 board")
Information

Assumptions

  • Device: TVP5151
  • Input connector: S-video (AIP1A (luminance), AIP1B (chrominance))
  • Video Format: NTSC (M, 4.43), PAL (B, G, H, I, M, N, Nc) or SECAM (B, D, G, K1, L)
  • Output format: 8-bit 4:2:2 YCbCr with discrete sync outputs

Recommended Settings

Recommended I2C writes: This setup requires additional writes to output the discrete sync 4:2:2 data outputs, the HSYNC, and the VSYNC, and to autoswitch between all video formats mentioned above.

  • I2C register address 00h = Video input source selection #1 register
    • I2C data 00h = Selects the Composite input
  • I2C register address 03h = Miscellaneous controls register address
    • I2C data 0Dh = Enables the YCbCr output data, HSYNC, VSYNC/PALI, AVID, and FID/GLCO
  • I2C register address 04h = Autoswitch mask register
    • I2C data C0h = Unmask NTSC-4.43, PAL-N, and PAL-M from the autoswitch process
  • I2C register address 0Dh = Outputs and data rates select register
    • I2C data 40h = Enables 8-bit 4:2:2 YCbCr with discrete sync output
i2cset -f -y 2 0x5c 0x00 0x00
i2cset -f -y 2 0x5c 0x03 0x0d
i2cset -f -y 2 0x5c 0x04 0xc0
i2cset -f -y 2 0x5c 0x0d 0x40

... UNDER DEVELOPMENT ...

--- That's all folks ---