Difference between revisions of "1012 TORADEX"
(→Gstreamer) |
|||
(22 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | == Toradex | + | == Using the Toradex CPU board with the Sensoray Model 1012 (or 2255) == |
− | The 1012 has been tested with the Toradex Apalis iMX6 board. Toradex provides their own support pages [http://developer.toradex.com here]. This wiki entry provides additional information for updating the kernel to support the [http://www.sensoray.com/1012 Sensoray 1012] device. The instructions also enable the [http://www.sensoray.com/2255 Model 2255 driver] for completeness. | + | |
+ | The Sensoray model 1012 has been tested with the Toradex Apalis iMX6 board. Toradex provides their own support pages [http://developer.toradex.com here]. This wiki entry provides additional information for updating the kernel to support the [http://www.sensoray.com/1012 Sensoray 1012] device. The instructions also enable the [http://www.sensoray.com/2255 Model 2255 driver] for completeness. | ||
The [http://developer.toradex.com/products/apalis-imx6 Apalis iMX6 CPU] provides PCIe support, needed for the 1012. Toradex also provides a convenient and recommended carrier board called the [http://developer.toradex.com/products/ixora-carrier-board Ixora] to connect the 1012 and provide other peripherals. Sensoray has tested with the iMX6Q and the Ixora V1.0A carrier board running software version V2.4 (3.10 kernel). The instructions here should be valid for future kernel versions. | The [http://developer.toradex.com/products/apalis-imx6 Apalis iMX6 CPU] provides PCIe support, needed for the 1012. Toradex also provides a convenient and recommended carrier board called the [http://developer.toradex.com/products/ixora-carrier-board Ixora] to connect the 1012 and provide other peripherals. Sensoray has tested with the iMX6Q and the Ixora V1.0A carrier board running software version V2.4 (3.10 kernel). The instructions here should be valid for future kernel versions. | ||
Line 17: | Line 18: | ||
=== Updating the 3.10 kernel, V2.4 Toradex version for the Apalis iMX6 === | === Updating the 3.10 kernel, V2.4 Toradex version for the Apalis iMX6 === | ||
− | ==== | + | ==== Prepare the microSD card ==== |
Attach a microSD card to your host system. The microSD card should be formatted with the FAT32 system and with standard DOS partition. On Linux, this is done with fdisk and mkfs.vfat. Their use is describe elsewhere. The easiest method would be to format the card on a Windows machine first. | Attach a microSD card to your host system. The microSD card should be formatted with the FAT32 system and with standard DOS partition. On Linux, this is done with fdisk and mkfs.vfat. Their use is describe elsewhere. The easiest method would be to format the card on a Windows machine first. | ||
− | Follow Step 1 only of the preparation procedure described here and with the additional details below | + | Follow Step 1 only of the preparation procedure described here and with the additional details below. The commands are listed as bullet points to be entered in a terminal window. |
[http://developer.toradex.com/knowledge-base/flashing-linux-on-imx6-modules Flashing Linux on IMX6 Modules] | [http://developer.toradex.com/knowledge-base/flashing-linux-on-imx6-modules Flashing Linux on IMX6 Modules] | ||
Line 27: | Line 28: | ||
# In step 1, download the Apalis iMX6 Linux Image. In our case, we use version 2.4 | # In step 1, download the Apalis iMX6 Linux Image. In our case, we use version 2.4 | ||
#* wget http://developer1.toradex.com/files/toradex-dev/uploads/media/Colibri/Linux/Images/old/Apalis_iMX6_LinuxImageV2.4Beta1_20150518.tar.bz2 | #* wget http://developer1.toradex.com/files/toradex-dev/uploads/media/Colibri/Linux/Images/old/Apalis_iMX6_LinuxImageV2.4Beta1_20150518.tar.bz2 | ||
+ | # Extract the image as superuser | ||
+ | #* sudo tar xjvf Apalis_iMX6_LinuxImageV2.4Beta1_20150518.tar.bz2 | ||
+ | # Change to the image directory that was extracted | ||
+ | #* cd Apalis_iMX6_LinuxImageV2.4 | ||
+ | #Find the mount point of the SD card and/or mount the SD card. If unsure, type "dmesg" after plugging in the microSD into card adapter (connected to the PC). The device should be printed in the log. In Fedora and Ubuntu, a popup window usually appears showing the mounted path of the device if clicked. In our case, the microSD is /dev/sdb1. We will mount it at /media/microSD. These instructions below are optional. The important point is to know the mount point. In Fedora, it may be /run/media/user/XYZ where XYZ are random for example. | ||
+ | #* sudo mkdir /media/microSD | ||
+ | #* sudo umount /dev/sdb1 | ||
+ | #* sudo mount /dev/sdb1 /media/microSD | ||
+ | # Install the base image to the SD card. This step may take some time | ||
+ | #* ./update.sh -o /media/microSD | ||
+ | # Change back to our home directory | ||
+ | #* cd ~ | ||
+ | |||
+ | ==== Obtain a cross-compiler ==== | ||
+ | Before building the kernel, you will need a cross compiler. Native compilation on the embedded system is not recommend. It would take considerable time and their may not be enough resources. It is highly recommended to use a [https://releases.linaro.org/components/toolchain/binaries/ pre-compiled toolchain]. | ||
+ | |||
+ | Building a toolchain is complex and very time consuming. [https://www.linaro.org/ Linaro] has greatly simplified the process. The version number of Linaro cross-compiler may depend on what kernel version you are compiling for. Newer compilers may not be able to compile older kernels and vice-versa. | ||
+ | |||
+ | #For the Apalis iMX6 3.10 kernel, version 4.9 is required. We also need the arm-linux-gnueabihf variant. (Embedded-Application Binary Interface Hard Float). | ||
+ | #*cd ~ | ||
+ | #*wget https://releases.linaro.org/components/toolchain/binaries/4.9-2017.01/arm-linux-gnueabihf/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz | ||
+ | #Extract the toolchain to your home directory (or other directory of choice) | ||
+ | #*tar xJvf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz | ||
+ | #Make a symbolic link to the toolchain | ||
+ | #*ln -s gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf gcc-linaro-4.9 | ||
+ | |||
+ | ==== Obtain and compile the source ==== | ||
+ | The instructions below refer to the [http://developer.toradex.com/knowledge-base/build-u-boot-and-linux-kernel-from-source-code instructions here]. Sensoray's wiki instructions are specific to the iMX6 with a version of the kernel known to work well with the board. | ||
+ | #Download the 3.10.17 kernel from Toradex | ||
+ | #*git clone -b toradex_imx_3.10.17_1.0.0_ga git://git.toradex.com/linux-toradex.git linux-toradex_v24.git | ||
+ | #Set the cross compilation environment variables | ||
+ | #* export ARCH=arm | ||
+ | #* export PATH=~/gcc-linaro-4.9/bin:$PATH | ||
+ | #* export CROSS_COMPILE=arm-linux-gnueabihf- | ||
+ | #Change to the Linux source directory | ||
+ | #*cd linux-toradex_v24.git | ||
+ | #Install the default build parameters | ||
+ | #*make apalis_imx6_defconfig | ||
+ | #Select the 1012 default kernel module using either A) or B) below | ||
+ | #*; Option A | ||
+ | ## Download config file from Sensoray | ||
+ | ##* wget http://www.sensoray.com/downloads/config_v24_toradex | ||
+ | ## Copy the config file to the current .config build | ||
+ | ##* cp config_v24_toradex .config | ||
+ | #*; Option B (manual method) | ||
+ | ##Run menuconfig | ||
+ | ##*make menuconfig | ||
+ | ##Use arrows to scroll down to "Device Drivers --->": Press Enter (<Select>) | ||
+ | ##Use arrows to scroll down to: "Multimedia support": Press Enter (<Select>) | ||
+ | ##Use arrows to scroll down to: "Analog TV support": Press Space Bar. Item selected will have an asterisk *. | ||
+ | ##Use arrows to scroll down to: "Media USB Adapters": Press Enter | ||
+ | ##Use arrows to scroll down to: "USB Sensoray 2255 Video capture device": Press Space bar to select. | ||
+ | ##Press right arrow once until <Exit> is selected. Press Enter. | ||
+ | ##Use arrows to scroll down to: "Media PCI Adapters": Press Space Bar to select then press Enter. | ||
+ | ##Use down arrow to scroll down to: "TW686x cards (NEW)".: Press Space Bar to select and press Enter | ||
+ | ##Use down arrow to scroll down to: "Philips SAA7134 support (NEW): Press Space Bar to select and press Enter. This installed other libraries that #may be useful in the future without having to recompile the entire kernel. | ||
+ | ##Press right arrow once until <Exit> is selected. Press Enter. Multimedia support menu will appear. | ||
+ | ##Press right arrow once until <Exit> is selected. Press Enter. This brings you back to the device drivers root menu. | ||
+ | ##Press right arrow once until <Exit> is selected. Press Enter. This brings you back to the main kernel root menu. | ||
+ | ##Press right arrow once until <Exit> is selected. Press Enter. A pop-up asking if you want to save your new configuration appears. <Yes> should be #selected. Press enter to save the configuration. | ||
+ | #Compile the kernel and modules | ||
+ | #*make clean | ||
+ | #*make -j3 uImage LOADADDR=10008000 | ||
+ | #*make -j3 modules | ||
+ | #Create new DTB files | ||
+ | #*make imx6q-apalis-eval.dtb | ||
+ | |||
+ | ==== Update the image ==== | ||
+ | #Copy the new image and modules to your microSD card by updating the base image and running update. | ||
+ | #*cd ~/linux-toradex_v24.git | ||
+ | #*sudo cp ~/linux-toradex_v24.git/arch/arm/boot/uImage ~/Apalis_iMX6_LinuxImageV2.4/apalis-imx6_bin/uImage | ||
+ | #*sudo cp ~/linux-toradex_v24.git/arch/arm/boot/dts/imx6q-apalis-eval.dtb ~/Apalis_iMX6_LinuxImageV2.4/apalis-imx6_bin/uImage-imx6q-apalis-eval.dtb | ||
+ | #*sudo -E make INSTALL_MOD_PATH=~/Apalis_iMX6_LinuxImageV2.4/rootfs/ modules_install | ||
+ | #The following commands assume the microSD is mounted at the mount point /media/microSD | ||
+ | #*cd ~/Apalis_iMX6_LinuxImageV2.4 | ||
+ | #*./update.sh -o /media/microSD | ||
+ | #Unmount the microSD card or adapter | ||
+ | #*sudo umount /media/microSD | ||
+ | |||
+ | === Update the kernel and modules on the Ixora embedded system === | ||
+ | #Remove the microSD from the host development computer | ||
+ | #Power down the embedded development board | ||
+ | #Insert the microSD card into the microSD slot on the Ixora board. It is on the bottom of the board near the HDMI connector. Please refer to the following doc for the location: [http://docs.toradex.com/101430-apalis-arm-ixora-datasheet.pdf Ixora datasheet] | ||
+ | #Connect the board via RS-232 serial console. On the host, use a terminal program such as minicom | ||
+ | #Make sure the minicom window is selected, ready for keyboard input. | ||
+ | #Power on the Ixora system. | ||
+ | #In the minicom window, press the spacebar immediately after text appears "Hit any key to stop autoboot". | ||
+ | #There should now be a prompt saying "Apalis iMX6 #". Type the following commands: | ||
+ | #*run setupdate | ||
+ | #*run update | ||
+ | #If it prompts to confirm updating the fuses, select yes. | ||
+ | #Wait for full completion and prompt to re-appear | ||
+ | #Reboot the Ixora system | ||
+ | |||
+ | == Application Software on Toradex == | ||
+ | The basic V4L capture program gstreamer is included in their distribution. The commands to use will depend on your application. You may also use your own V4L capture software or use other V4L third party applications. | ||
+ | |||
+ | === Gstreamer === | ||
+ | #Update the packages | ||
+ | #*opkg install gst-plugins-base-ffmpegcolorspace | ||
+ | #*opkg install gst-plugins-base | ||
+ | #*opkg install gst-plugins-good | ||
+ | #*opkg install gst-plugins-bad | ||
+ | #*opkg install gst-plugins-ugly | ||
+ | #*opkg install gstreamer1.0 | ||
+ | #*opkg install gstreamer1.0-plugins-good | ||
+ | #*opkg install gstreamer1.0-plugins-bad | ||
+ | #*opkg install gstreamer1.0-plugins-ugly | ||
+ | #*opkg install gstreamer1.0-plugins-base | ||
+ | #*opkg install gstreamer1.0-plugins-good-video4linux2 | ||
+ | #*opkg install gstreamer1.0-plugins-good-video4linux2-dev | ||
+ | |||
+ | |||
+ | #Example Gstreamer pipelines for previewing on the screen. | ||
+ | #*gst-launch v4l2src norm=NTSC device=/dev/video0 ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! ximagesink | ||
+ | #*gst-launch v4l2src norm=NTSC device=/dev/video0 ! video/x-raw-yuv,width=640,height=480 ! mfw_v4lsink disp-width=640 disp-height=480 axis-top=50 axis-left=100 | ||
+ | #More complicated usage and other pipelines are to be determined by the user. Displaying multiple video channels to the screen may require a clever pipeline to merge or mix the streams together. It may also require other Gstreamer elements for efficiency such as imxeglvivsink. The exact command syntax will be determined by the application. | ||
+ | |||
+ | [[Category:1012|Toradex]] |
Latest revision as of 10:58, 4 June 2020
Contents |
[edit] Using the Toradex CPU board with the Sensoray Model 1012 (or 2255)
The Sensoray model 1012 has been tested with the Toradex Apalis iMX6 board. Toradex provides their own support pages here. This wiki entry provides additional information for updating the kernel to support the Sensoray 1012 device. The instructions also enable the Model 2255 driver for completeness.
The Apalis iMX6 CPU provides PCIe support, needed for the 1012. Toradex also provides a convenient and recommended carrier board called the Ixora to connect the 1012 and provide other peripherals. Sensoray has tested with the iMX6Q and the Ixora V1.0A carrier board running software version V2.4 (3.10 kernel). The instructions here should be valid for future kernel versions.
In order to use the 1012 with the Toradex CPU board, you will need cross-compile a new kernel and driver modules.
[edit] Pre-requisites
- user should have some familiarity with kernel development and compilation
- C development tools installed
- git source countrol package installed. On Ubuntu, use "sudo apt-get install git". On Fedora, use "sudo dnf install git"
- microSD card
- Host RS-232 serial port support (or USB dongle), and cable.
- RS-232 adapter for the Ixora board
- microSD card reader for host computer
[edit] Updating the 3.10 kernel, V2.4 Toradex version for the Apalis iMX6
[edit] Prepare the microSD card
Attach a microSD card to your host system. The microSD card should be formatted with the FAT32 system and with standard DOS partition. On Linux, this is done with fdisk and mkfs.vfat. Their use is describe elsewhere. The easiest method would be to format the card on a Windows machine first.
Follow Step 1 only of the preparation procedure described here and with the additional details below. The commands are listed as bullet points to be entered in a terminal window.
Flashing Linux on IMX6 Modules
- In step 1, download the Apalis iMX6 Linux Image. In our case, we use version 2.4
- Extract the image as superuser
- sudo tar xjvf Apalis_iMX6_LinuxImageV2.4Beta1_20150518.tar.bz2
- Change to the image directory that was extracted
- cd Apalis_iMX6_LinuxImageV2.4
- Find the mount point of the SD card and/or mount the SD card. If unsure, type "dmesg" after plugging in the microSD into card adapter (connected to the PC). The device should be printed in the log. In Fedora and Ubuntu, a popup window usually appears showing the mounted path of the device if clicked. In our case, the microSD is /dev/sdb1. We will mount it at /media/microSD. These instructions below are optional. The important point is to know the mount point. In Fedora, it may be /run/media/user/XYZ where XYZ are random for example.
- sudo mkdir /media/microSD
- sudo umount /dev/sdb1
- sudo mount /dev/sdb1 /media/microSD
- Install the base image to the SD card. This step may take some time
- ./update.sh -o /media/microSD
- Change back to our home directory
- cd ~
[edit] Obtain a cross-compiler
Before building the kernel, you will need a cross compiler. Native compilation on the embedded system is not recommend. It would take considerable time and their may not be enough resources. It is highly recommended to use a pre-compiled toolchain.
Building a toolchain is complex and very time consuming. Linaro has greatly simplified the process. The version number of Linaro cross-compiler may depend on what kernel version you are compiling for. Newer compilers may not be able to compile older kernels and vice-versa.
- For the Apalis iMX6 3.10 kernel, version 4.9 is required. We also need the arm-linux-gnueabihf variant. (Embedded-Application Binary Interface Hard Float).
- Extract the toolchain to your home directory (or other directory of choice)
- tar xJvf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz
- Make a symbolic link to the toolchain
- ln -s gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf gcc-linaro-4.9
[edit] Obtain and compile the source
The instructions below refer to the instructions here. Sensoray's wiki instructions are specific to the iMX6 with a version of the kernel known to work well with the board.
- Download the 3.10.17 kernel from Toradex
- git clone -b toradex_imx_3.10.17_1.0.0_ga git://git.toradex.com/linux-toradex.git linux-toradex_v24.git
- Set the cross compilation environment variables
- export ARCH=arm
- export PATH=~/gcc-linaro-4.9/bin:$PATH
- export CROSS_COMPILE=arm-linux-gnueabihf-
- Change to the Linux source directory
- cd linux-toradex_v24.git
- Install the default build parameters
- make apalis_imx6_defconfig
- Select the 1012 default kernel module using either A) or B) below
- Option A
- Download config file from Sensoray
- Copy the config file to the current .config build
- cp config_v24_toradex .config
- Option B (manual method)
- Run menuconfig
- make menuconfig
- Use arrows to scroll down to "Device Drivers --->": Press Enter (<Select>)
- Use arrows to scroll down to: "Multimedia support": Press Enter (<Select>)
- Use arrows to scroll down to: "Analog TV support": Press Space Bar. Item selected will have an asterisk *.
- Use arrows to scroll down to: "Media USB Adapters": Press Enter
- Use arrows to scroll down to: "USB Sensoray 2255 Video capture device": Press Space bar to select.
- Press right arrow once until <Exit> is selected. Press Enter.
- Use arrows to scroll down to: "Media PCI Adapters": Press Space Bar to select then press Enter.
- Use down arrow to scroll down to: "TW686x cards (NEW)".: Press Space Bar to select and press Enter
- Use down arrow to scroll down to: "Philips SAA7134 support (NEW): Press Space Bar to select and press Enter. This installed other libraries that #may be useful in the future without having to recompile the entire kernel.
- Press right arrow once until <Exit> is selected. Press Enter. Multimedia support menu will appear.
- Press right arrow once until <Exit> is selected. Press Enter. This brings you back to the device drivers root menu.
- Press right arrow once until <Exit> is selected. Press Enter. This brings you back to the main kernel root menu.
- Press right arrow once until <Exit> is selected. Press Enter. A pop-up asking if you want to save your new configuration appears. <Yes> should be #selected. Press enter to save the configuration.
- Compile the kernel and modules
- make clean
- make -j3 uImage LOADADDR=10008000
- make -j3 modules
- Create new DTB files
- make imx6q-apalis-eval.dtb
[edit] Update the image
- Copy the new image and modules to your microSD card by updating the base image and running update.
- cd ~/linux-toradex_v24.git
- sudo cp ~/linux-toradex_v24.git/arch/arm/boot/uImage ~/Apalis_iMX6_LinuxImageV2.4/apalis-imx6_bin/uImage
- sudo cp ~/linux-toradex_v24.git/arch/arm/boot/dts/imx6q-apalis-eval.dtb ~/Apalis_iMX6_LinuxImageV2.4/apalis-imx6_bin/uImage-imx6q-apalis-eval.dtb
- sudo -E make INSTALL_MOD_PATH=~/Apalis_iMX6_LinuxImageV2.4/rootfs/ modules_install
- The following commands assume the microSD is mounted at the mount point /media/microSD
- cd ~/Apalis_iMX6_LinuxImageV2.4
- ./update.sh -o /media/microSD
- Unmount the microSD card or adapter
- sudo umount /media/microSD
[edit] Update the kernel and modules on the Ixora embedded system
- Remove the microSD from the host development computer
- Power down the embedded development board
- Insert the microSD card into the microSD slot on the Ixora board. It is on the bottom of the board near the HDMI connector. Please refer to the following doc for the location: Ixora datasheet
- Connect the board via RS-232 serial console. On the host, use a terminal program such as minicom
- Make sure the minicom window is selected, ready for keyboard input.
- Power on the Ixora system.
- In the minicom window, press the spacebar immediately after text appears "Hit any key to stop autoboot".
- There should now be a prompt saying "Apalis iMX6 #". Type the following commands:
- run setupdate
- run update
- If it prompts to confirm updating the fuses, select yes.
- Wait for full completion and prompt to re-appear
- Reboot the Ixora system
[edit] Application Software on Toradex
The basic V4L capture program gstreamer is included in their distribution. The commands to use will depend on your application. You may also use your own V4L capture software or use other V4L third party applications.
[edit] Gstreamer
- Update the packages
- opkg install gst-plugins-base-ffmpegcolorspace
- opkg install gst-plugins-base
- opkg install gst-plugins-good
- opkg install gst-plugins-bad
- opkg install gst-plugins-ugly
- opkg install gstreamer1.0
- opkg install gstreamer1.0-plugins-good
- opkg install gstreamer1.0-plugins-bad
- opkg install gstreamer1.0-plugins-ugly
- opkg install gstreamer1.0-plugins-base
- opkg install gstreamer1.0-plugins-good-video4linux2
- opkg install gstreamer1.0-plugins-good-video4linux2-dev
- Example Gstreamer pipelines for previewing on the screen.
- gst-launch v4l2src norm=NTSC device=/dev/video0 ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! ximagesink
- gst-launch v4l2src norm=NTSC device=/dev/video0 ! video/x-raw-yuv,width=640,height=480 ! mfw_v4lsink disp-width=640 disp-height=480 axis-top=50 axis-left=100
- More complicated usage and other pipelines are to be determined by the user. Displaying multiple video channels to the screen may require a clever pipeline to merge or mix the streams together. It may also require other Gstreamer elements for efficiency such as imxeglvivsink. The exact command syntax will be determined by the application.