QEMU can be very useful tool in developing wide range of software from simple application to even linux kernel itself for arm based embedded system. Here is to show how developing and debugging simple application for virtual arm based platform with QEMU is actually easy to people who are lazy so hate to move his/her finger to turn on real board and for poor people who do not have any real hardware.


Note: This post assume Host system is fairly new Ubuntu machine(For my case, its ubuntu 12.04 64bit)


Below is list for bullet items which this post focus.


1. How to build simple c application with a assembly library which can be callable in c function.

2. How to run the executable in Qemu

3. Debugging it with gdb



Phase 0. TOOL Setup


Before delving into programming, we need to check all necessary tools ready. Please refer to below command to install all of them. 


First install linaro image tools.


host$ sudo apt-get install linaro-image-tools


To get qemu to work with, there are two ways to building from source code and using apt-get but here I used apt-get as like below.


host$ sudo add-apt-repository ppa:linaro-maintainers/tools
host$ sudo apt-get update
host$ sudo apt-get install qemu-user-static qemu-system

To be able to compile c and assembly, we need to install crosstool chain for arm.


host$ sudo apt-get install gcc-arm-linux-gnueabi


Phase 1. Creating a simple application made up of c and assembly combination 


I wrote some articles in this site how to create CMake project so here I would like to show only source code without detailed explanation about it and why it is needed.


There are 4 files required in the project. 

1. main.c                                          # main c source code including main()

2. square.s                                       # assembly file containing functions callable in main() 

3. CMakeLists.txt                               # main cmake project file

4. toolchain-for-qemuarm.cmake          # cmake module used for cross compilation for arm target system


So just create below all 4 files in a $(EXAMPLE) directory.


main.c


square.s


CMakeLists.txt



toolchain-for-qemuarm.cmake


Note: Here I used gcc toolchain from Freescale site but you may use other popular toolchain also.


One you have those file, it is easy to build binary which will be run on qemu.


host$ mkdir build; cd build

host$ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain-for-qemuarm.cmake ..


Now you can check arm executable created correctly

host$ arm-linux-gnueabi-readelf ./program -a | more

ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: ARM Version: 0x1 Entry point address: 0x8538 Start of program headers: 52 (bytes into file) Start of section headers: 3592 (bytes into file) Flags: 0x5000002, has entry point, Version5 EABI

For source codes, download this. 

cassemtest.tar.gz



Phase 2. Test with QEmu

The built program depends on external libary called ld-linux.so.3 and this is arm side shared libary. So qemu need to know where to find correct shared library for this arm friendly executable. In below, I informed /usr/arm-linux-gnueabi which was created when I installed cross-toolchain mentioned in phase 0. ( FYI, when I used one included in freescale toolchain, system got corrupted for uncertain reason)

host$ qemu-arm-static -L /usr/arm-linux-gnueabi ./program

sum(1, 100) = 101 Hello, ARM World!

The printed message above shows that program ran as intended.


Phase 3. Debugging with Qemu + gdb

With gdb, user can debug application in source level. I already gave option "SET(CMAKE_BUILD_TYPE debug)" to include debug symbol in the executable by including one line in CMakeList.txt so the executable should contain symbol table in itself.

host$ qemu-arm-static -g 1234 -L /usr/arm-linux-gnueabi ./program


With -g 1234 option in the above command, qemu is waiting for gdb connection via port 1234 of localhost.

host$ sudo apt-get install gdb-multiarch

host$ gdb-multiarch

...

(gdb) file program

Reading symbols from /home/<user>/work/qemu/linaro/examples/cassemtest/build/program...done.

(gdb) target remote localhost:1234

Remote debugging using localhost:1234 [New Remote target] warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. [Switching to Remote target] 0xf67dfc40 in ?? ()

(gdb) b main

Breakpoint 1 at 0x85f0: file /home/<user>/work/qemu/linaro/examples/cassemtest/main.c, line 8.

(gdb) c

Continuing. warning: Could not load shared library symbols for 2 libraries, e.g. /lib/libc.so.6. Use the "info sharedlibrary" command to see the complete listing. Do you need "set solib-search-path" or "set sysroot"? Breakpoint 1, main () at /home/<user>/work/qemu/linaro/examples/cassemtest/main.c:8 8 int a=1, b =100;


Conclusion


So far showed how simple application debugging with qemu can be done and hope this post will help app development for embedded system under qemu sandbox which will throw away any worry to break system due to SW bug.

   



Posted by kevino
,

On Mac, it was hard to find out how to capture web camera input to me and this is to share what i found in dealing with gstreamer to capture live webcam input on my Macbook running OS X 10.7.5.



To use GStreamer, the necessary package should be installed and the following link shows how to install it.


http://docs.gstreamer.com/display/GstSDK/Installing+on+Mac+OS+X


Before running gst-launch, few more steps are needed because the path containing the gst binaries may not be included in PATH env variable. I recommend that few symbolic links to gst binaries be created in /usr/bin/ path.

For example, at command line, run below command to create those files.


$ sudo ln -s /Library/Frameworks/GStreamer.framework/Versions/Current/bin/gst-launch-0.10 /usr/bin/gst-launch

$ sudo ln -s /Library/Frameworks/GStreamer.framework/Versions/Current/bin/gst-inspect-0.10 /usr/bin/gst-inspect


Now we can test whether gstreamer is working properly.


Example 1: Testing with pre-made video source in gstreamer and displaying it in a window.


$ gst-launch videotestsrc ! osxvideosink


Example 2: Displaying webcam input in a window


$ gst-launch autovideosrc ! osxvideosink



Example 3: Grabbing one frame from webcam and saving it as jpeg


$ gst-launch -v -e autovideosrc num-buffers=1 ! jpegenc ! filesink location=capture1.jpeg


So far, all examples above are shown as command line use case.

Before completing this post, here come a sample c source code with cmake script which will ease developing user application for one's own use. The source file is taken from gstreamer tutorial page at http://docs.gstreamer.com/pages/viewpage.action?pageId=327735 so if details about it is required, then you can check it also in the link.


This project source was tested with my macbook.



gst-example-prj.tar.7z


 

Posted by kevino
,

이번 글은 리눅스 커널 3.6버전 부터 공식적으로 지원하는 device tree 에 관련된 몇가지 유용한 정보를 담고 있다.


우선 device tree에 대한 것을 최대한 간단히 설명하면 하드웨어를 기술하는 데이터 구조라고 www.devicetree.org에 나와 있는데 좀더 자세한 내용은 그쪽 사이트를 참조하도록 하고 여기에서는 개인적으로 이해하고 있는 내용을 그때 그때 추가해놓았다. 사실 devicetree는 방대한 개념이어서 이것을 모두 설명하기는 힘드니 필요할때마다 여기에 추가해서 갱신하고자 한다.


첫째, device tree는 범용적으로 하드웨어를 기술할 수 있는 데이터 구조만을 정의해놓아서 수만 수천가지의 장치에 대해 모두 동일하게 작성한다는 것이 불가능하기에 그때 그때 상황에 맞추어서 작가가 나름의 구조를 고안해서 작성하게 된다. 그래서 플랫폼마다 독자적인 개성을 가진 구조를 가지게 되고 그것을 접해보지 못한 작가가 만들어 놓은 device tree script(이하 dts )를 그대로 이용하려는 경우 적용이 불가능하게 되는 경우도 생겨서 이런 것들을 지원하려다 보면 부득이하게 새로운 구조라든지 device tree compiler(이하 dtc)에서 지원하는 새로운 키워드라든지 문구를 새로 만들기도 한다. 


beaglebone black(이하 BBB)에서도 마찬가지로 인터넷에서 떠돌아다니는 dts를 받아다 기본적으로 설치되어 있는 dtc로 컴파일하려하면 컴파일 오류를 만들어 내는 경우가 있을 수 있다. 이런 경우에는 기본설치된 dtc가 해당 dts에서 지원하는 문법을 지원하지 못하기에 발생하는 문제인데 이런 경우는 새로운 dtc 소스를 받아다가 몇몇 패치를 적용해서 만들어진 dtc를 이용하면 문제가 해결된다. 아래 방법을 보였는데 필요한 경우 원소스를 밝히니 참고하기 바란다.



우선 BBB에서 동작하는 dts가 필요한데 여기서는 다음링크에 있는 dts를 참고하기로 한다.


http://hipstercircuits.com/capture-input-events-via-gpio-on-beaglebone-black/


/dts-v1/;
/plugin/;

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    /* identification */
    part-number = "BB-GPIO-KEYS";
    version = "00A0";

    fragment@0 {
        target = <&am33xx_pinmux>;
        __overlay__ {
            end_stop_pins: pinmux_end_stop_pins{
                pinctrl-single,pins = <
                    0x090 0x37 // P8_7  = End stop X1  = GPIO2_2
                    0x070 0x37 // P9_11 = End stop Y1  = GPIO0_30
                    0x074 0x37 // P9_13 = End stop Z1  = GPIO0_31
                    0x158 0x37 // P9_18 = End stop Z2  = GPIO0_4
                    0x1AC 0x37 // P9_25 = End stop Y2  = GPIO3_21
                    0x180 0x37 // P9_26 = End stop X2  = GPIO0_14
                >;
            };
        };
    };

    fragment@1 {
        target = <&ocp>;
        __overlay__ {            
            #address-cells = <1>;
            #size-cells = <1>;                            

            gpio_keys {
                compatible = "gpio-keys";
                pinctrl-names = "default";
                pinctrl-0 = <&end_stop_pins>;
                #address-cells = <1>;
                #size-cells = <0>;

                switch_x1 {
                    label = "End-stop-X1";
                    debounce_interval = <50>;
                    linux,code = <1>;
                    gpios = <&gpio3 2 0x5>;
                    gpio-key,wakeup;
                };                
                switch_x2 {
                    label = "End-stop-X2";
                    debounce_interval = <50>;
                    linux,code = <2>;
                    gpios = <&gpio1 14 0x5>;
                    gpio-key,wakeup;
                };
                switch_y1 {
                    label = "End-stop-Y1";
                    debounce_interval = <50>;
                    linux,code = <3>;
                    gpios = <&gpio1 30 0x5>;
                    gpio-key,wakeup;
                };                
                switch_y2 {
                    label = "End-stop-Y2";
                    debounce_interval = <50>;
                    linux,code = <4>;
                    gpios = <&gpio4 21 0x5>;
                    gpio-key,wakeup;
                };                
                switch_z1 {
                    label = "End-stop-Z1";
                    debounce_interval = <50>;
                    linux,code = <5>;
                    gpios = <&gpio1 31 0x5>;
                    gpio-key,wakeup;
                };                
                switch_z2 {
                    label = "End-stop-Z2";
                    debounce_interval = <50>;
                    linux,code = <6>;
                    gpios = <&gpio1 4 0x5>;
                    gpio-key,wakeup;
                };                
            };
        };
    };
};


위의 dts를 보면 두번째줄 /plugin/문구가 있는데 이것을 기본설치된 dtc로 컴파일하면 오류가 나면서 실패하게 된다. 이를 해결하기 위해서는 다음과 같이 패치된 dtc를 이용해야 한다.(출처:http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming-on-arm-embedded-linux/)


$ git clone git://www.jdl.com/software/dtc.git
$ cd dtc
$ git checkout 27cdc1b16f86f970c3c049795d4e71ad531cca3d
$ wget https://github.com/beagleboard/meta-beagleboard/raw/master/common-bsp/recipes-kernel/dtc/dtc/0001-dtc-Dynamic-symbols-fixup-support.patch
$ patch -p1 < 0001-dtc-Dynamic-symbols-fixup-support.patch
$ make

위의 결과로 만들어진 dtc로 컴파일 하면 위의 dts가 정상적으로 컴파일될수 있다. 여기서 만들어진 dtbo를 리눅스 커널에 적재하려면 위의 언급된 사이트에 기술된 내용대로 하면 된다. 물론 위의 dts는 기본 BBB와 별도의 키입력용으로 만들어진 확장 보드를 동작시키기 위한 파일로 기본 BBB만 가지고는 실행할수 있는 있되 기능동작확인은 되지 않는 점을 밝혀둔다.



Posted by kevino
,

This post is to show a real example for cross compiling SDL library for target arm board and include all necessary steps from downloading the library to installation of the compiled package to the root file system for target board.


For this real example, I worked with below settings.


Host machine: Ubuntu 12.04 x86-64 bit

HW: Beaglebone black(BBB) with 4GB uSD card

OS: Ubuntu 13.04 (http://rcn-ee.net/deb/rootfs/raring/ubuntu-13.04-console-armhf-2013-07-22.tar.xz)

Toolchain for cross compile: Refer to below Step 0.






For the first time you need to get prebuilt image for Ubuntu 13.04 version and prepare bootable SD card.


Step 0: Preparing toolchain and building Linux kernel for BBB


git clone git://github.com/RobertCNelson/linux-dev.git
cd linux-dev
git checkout origin/am33x-v3.8 -b tmp
./build_kernel.sh

After running ./build_kernel.sh , there will be toolchain installed at linux-dev/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux and also linux kernel binary can be found.


Step 1. For flashing uSD card with Ubuntu 13.04 image, refer to the following link

http://elinux.org/BeagleBoardUbuntu


If you follow the guide in the above link without any error, u can have the uSD burned with bootable image and with it in uSD card slot, you can boot Ubuntu 13.04 on BBB.


Step 2. Now its time to do cross compile SDL.


For this, you need to prepare root file system for BBB before compilation of SDL and you can find the prebuild root file system file in the above file.


Unpack image:

tar xJf ubuntu-13.04-console-armhf-2013-07-22.tar.xz
cd ubuntu-13.04-console-armhf-2013-07-22
sudo tar xfv armhf-rootfs-ubuntu-raring.tar -C ~/rootfs/

Ok. root file system is ready. 


Step 3. Next step is downloading SDL package.

cd ~/rootfs/home/ubuntu
wget http://www.libsdl.org/release/SDL-1.2.15.tar.gz
tar xvfz SDL-1.2.15.tar.gz
cd SDL-1.2.15

For proper compilation and installation, you need to make sure that proper toolchain for BBB (refer to step 0) and inform path to tool chain to Configure script.


Step 4. Configuring and compiling SDL

Below is a script doing configuration and make for my setting. Some modification of this script may be needed to different setting.

Write down a shell script with below content and run it.

Note: Need to replace <user> in the above box with proper name to your system.



Step 5: Installation SDL to target root file system

Now if there is no error after running this script than you can install SDL package to target root file system running below command:


sudo make install


All setup is completed. As like this, you can install other libraries too, for example SDL_image library. 

End.


Next post will be how to make a sample SDL project which will run on target board with help of CMake.




Posted by kevino
,

This is extended from my previous post: http://kevino.tistory.com/entry/CMakeqt5-Simple-example-for-CMake-QT5-package.


The source files in the above link is intended to be built on Host system and run on local machine. Here I will explain how to cross compile the same source codes  with almost same environment.


In order to develop QT app targeted for Arm embedded system, you need to first prepare Qt5 framework suitable for target board.


For i.MX6 Sabre SDB, refer to the following link: https://community.freescale.com/docs/DOC-94066. If you dont see any error in completing procedures described in the above link, you can find many example binaries created in $(TARGET_rootfs)/opt/qt5/examples and verify by running several examples.


Note. You may not see examples compiled even though you followed all steps. In this case, you can compile the examples manually by running below commands on Host system. If compilation is successful, then verify examples by running those on target board.


$ cd $(QTdir)/qtbase

$ make sub-examples


For now, before running cross compile commands, make sure that the following conditions are all met.


1. Target system is booted via nfs and "/" is mounted on ${TARGET_rootfs) of host system.

2. Qt5 for target board is installed at $(TARGET_rootfs)/opt/qt5 and examples at $(TARGET_rootfs)/opt/qt5/examples.

3. Need to verify whether Qt5 works by running example files and checking QT logo moving in 3D screen.

Target> cd /opt/qt5/examples

Target> ./opengl/hellogl_es2/hellogl_es2


If Qt5 is installed, then lets reuse the project source code which will be converted app for target board.


First we need to inform CMake that we will use cross compile and CMake dev team already made this solution since Cmake 2.6 version. 


For this, we can create a new cmake module similar to the below and remember its path.


Toolchain-freescale-imx6q.cmake


Now you can run cmake with crosscompile options to build the source codes. Assuming the above setup,


$ cd /home/<userid>/utils/ltib/rootfs/root

$ 7za x sample1.7z

$ cd sample1

$ mkdir build

$ cd build

$ cmake -DCMAKE_TOOLCHAIN_FILE=$(PATH_to_)/Toolchain-freescale-imx6q.cmake ..

$ make



Note. While running cmake, if you notice an error "Failed to find GLESv2 in "", then you can fix this error by modifying Qt5GuiConfigExtras.cmake at /home/<userid>/utils/ltib/rootfs/opt/qt5/lib/cmake/Qt5Gui/.


At 50 lines

- _qt5gui_find_extra_libs(OPENGL "GLESv2;GLESv2;EGL;GAL" "" "")

+ _qt5gui_find_extra_libs(OPENGL "GLESv2;GLESv2;EGL;GAL" ${CMAKE_FIND_ROOT_PATH}/usr/lib/ "")


I dont think this patch is good but it works for me so you can use this until official patch is ready. At least Qt 5.1.0 has this problem.


You can examine the exe file in target machine whether this Qt5 app can be run. If successful, now you are ready to develop Qt5 application running on Target board.




Posted by kevino
,

This post describes what I did to run ltib from L3.0.35_4.0.0_130424_source.tar.gz on Linux host machine version Ubuntu 12.04 64bit Precise.


Actually I referred the following https://community.freescale.com/message/314151#314151 and added minor things.



Steps I did


1. Download L3.0.35_4.0.0_130424_source.tar.gz and install it.

2. Download this patch-ltib-ubuntu12.04.sh and copy the script file in the <LTIB_root_dir> and execute it. Make sure this update complete without error.

3. Run ltib in <LTIB_root_dir>


While running ltib, you will be asked to configure build options for kernel, For me, I just selected "mx6qsabre_nand" platform and did not touched other thing. 


If you choose u-boot-v2009.08 as boot loader, then you may pass compilation of uboot with success. At least it was successful for me.


In case of error complaining "arm-fsl-linux-gnueabi/bin/ld: cannot find /lib/libc.so.6", then apply the suggestion in this  link.

Hi John,

 

I just noticed that my earlier note was cryptic, but in this case, you're seeing the same problem as I had: LTIB is trying to find libraries in your host system directories. In other words, it's trying to load /lib/libc.so.6 instead of finding the library within the LTIB tree.

 

The answer seems to be simple. Go into ltib/dist/lfs/base_libs/base_libs.spec and find these lines:

     # remove absolute paths from text search files (if they exist)

     perl -w -e '

         @ARGV = grep { `file $_` =~ m,ASCII C program text, } @ARGV;

         exit(0) unless @ARGV;

 

Remove the last two (the lines beginning with "@ARGV" and "exit(0)" and you should be good to go.


4. If ltib run correctly, you can see rootfs.jffs2 is created in <LTIB_root_dir>if you chose NAND image in configuration stage.




Posted by kevino
,

How to make ubuntu 32 bit environment using chroot on Ubuntu 12.04 64 bit


1. Setup basic chroot


$ sudo apt-get install debootstrap
$ sudo apt-get install schroot
$ sudo mkdir /var/chroot/
$ sudo editor /etc/schroot/schroot.conf

Fill /etc/schroot/schroot.conf with below (Assuming your account is king)

[lucid]

description=Ubuntu Lucid

#location=/var/chroot

directory=/var/chroot/

personality=linux32

priority=3

users=king

root-users=king

groups=sbuild

root-groups=root

Note:

  • personality: Enable this line if the host system is 64-bit running on an amd64/x64 computer and the chroot is 32-bit for i386. Otherwise, leave it disabled.


After modifying schroot.conf, donwload lucid data from the Ubuntu repository


$ sudo debootstrap --variant=buildd --arch i386 lucid /var/chroot/ http://kr.archive.ubuntu.com/ubuntu/


Useful settings


$ sudo mount -o bind /proc /var/chroot/proc
$ sudo ln -f /etc/apt/sources.list /var/chroot/etc/apt/sources.list

2. Entering chroot envrinment


After basic installation of Ubuntu Lucid completion, run below command to change to chroot environment with root account.


$ $ sudo chroot /var/chroot
or
$ schroot -c lucid -u root


In chroot, install basic ubuntu package by running below command


# apt-get install ubuntu-minimal # apt-get update


If you notice any error somthing like "GPG error ... public key is not available: KEY_VALUE", then you can run below command to add the public key so that make "apt-get update" end with no such error and rerun "apt-get update" to complete all setup.


# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <KEY_VALUE>

Now you are ready to use full 32 bit app development in Ubuntu Lucid version.


Posted by kevino
,

이번에도 CMake를 이용한 Qt5 용 프로젝트를 구성하는 방법에 대해 소개한다.


새롭게 이전 Qt 4.8버전하고 Qt5버전에서 Cmake 사용방법이 많이 바뀌어서 유의해야 할 부분을 중점으로 보여주기위한 글이므로 실제 프로젝트의 내용은 별거 없고 CmakeLists.txt파일 작성하는 부분을 중점적으로 보면 되겠다. 기본적인 정보는 다음의 링크를 참조해서 만들었다.


http://qt-project.org/doc/qt-5.0/qtdoc/cmake-manual.html#imported-targets


우선 시험 환경은 다음과 같다.


OS: Windows 7

CMake: version 2.8.11

Qt5: version 5.0.2


다른 내용은 별다른 것 없고 CMakeLists.txt를 주목해서 보는데 아래에 전체 소스를 표시하고 있다.


CMakeLists.txt



지금까지 연재해온 Cmake 시리즈와 다른 것은 별로 없고 눈여겨봐야 할 부분은 Visual Studio에서 디버깅시 보통의 경우 Qt5Widgetd.dll파일이 없다면서 실행에 실패할 것인데 이 경우 전역 변수 PATH에 Qt5 디렉토리를 추가해주면 문제가 해결될 것이나, 그렇지 않은 경우 VS용 프로젝트 파일의 설정값을 건드려서 정상동작하도록 만든 부분으로 그 설정은 아래와 같이 해주면 된다.


include(CreateLaunchers)

create_target_launcher(sample1 ENVIRONMENT  "PATH=${QTDIR}/bin")


실제로 동작가능한 프로젝트 파일은 아래에 올려두니 유용하게 쓰시기 바란다.


<추가> Linux에서 Qt5Widgets.cmake를 못찾는다는 오류가 나올때 해결방법

해당 qt5관련 cmake 모듈을 못찾는 경우에 발생한다. 이런 경우 CMAKE_PREFIX_PATH에 해당 위치를 지정해줘야 하는데 형식은 다음과 같다

if(UNIX)

set (CMAKE_PREFIX_PATH  <PATH_to_CmakeModules>)

endif(UNIX)


본인의 경우 다음과 같이 지정해주었다

set (CMAKE_PREFIX_PATH "/home/<userid>/Qt/5.1.0/gcc_64/lib/cmake")



sample1.7z


Posted by kevino
,

Will be updated if any tip is founded in Unix area.


1. GCC


a. How to check gcc default settings

    >> echo "" | g++ - -xc -v -E


b. How to see a full list of compiler defined macro.

>> gcc -dM -E - < /dev/null


2. Ubuntu

a. Installation of 32 bits libraries which enable to run 32 bit app on Ubuntu 64 bits ( Simpler method than b)

$ echo foreign-architecture i386 | sudo tee /etc/dpkg/dpkg.cfg.d/multiarch
$ sudo apt-get update
$ sudo apt-get install ia32-libs


b. Installation of 32 bits libraries which enable to run 32 bit app on Ubuntu 12.04 64 bits( I recommend use above way instead of this because a is much simpler. )



Answer: Refer to below description

(Original source: http://askubuntu.com/a/190419)


I had a similar problem with broken dependencies when trying to install wine and acroread, and a complaint when trying to install ia32-libs-multiarch, just after upgrading to 12.04 from 11.04 (passing over 11.10). It seems that some ppa's I had in 11.04 installed newer versions of applications in the system. After upgrading, the remains of these apps seemed to do some mess in the dependencies.

The solution that seems to work (until now), was found on a german ubuntu board (http://forum.ubuntuusers.de, posts from user Lasall):

First a downgrade is required and done with the following: create the 'preferences' file:

sudo vi /etc/apt/preferences

and insert the following lines:

Package: *       
Pin: release a=precise*
Pin-Priority: 2012

enter:wq to write the file. Pin-Priority must be greater than 1000.

Then you may downgrade the offending applications with:

sudo apt-get dist-upgrade

Then you may install packages that complained about dependencies, like sudo apt-get install ia32-libs-multiarch, or sudo apt-get install ia32-libs.

Finally, you should remove the file you just created:

sudo rm /etc/apt/preferences

because else no new updates would be found.

Hope this helps you too!



3. Continuous dmesg output (from: http://www.backtrack-linux.org/forums/showthread.php?t=35966)

Run dmesg | tail first so that you can see the end then run the following and it will update whenever/ if something changes from the above. 

Code:
 root@nerd:~#  watch --differences dmesg | tail

4. git usage

    - Create archive in zip format from repository.

       git archive --format zip --output /full/path/to/zipfile.zip master


5. cat multiple files into single file


cat $(ls frame-*.raw | sort -n -t - -k 2) > full.file


explanation


-n: sorts numerically
-t: field separator '-'
-k: sort on second field, in your case the numbers after the first '-'

$() : The standard output of command in $() is fed to cat.

Posted by kevino
,

GDB tips

프로그래밍/linux 2012. 6. 27. 17:48

In this article, I want to share all my findings and gathered information to help debugging with GDB.


1. How to set program arguments when debugging a program.

   ex) If you want to execute following command, 'progname -o outdir inputfilename'

        Then you can provide program's arguments to gdb like this

        $ gdb -ex 'set args -o outdir inputfilename' progname



Posted by kevino
,