Monday, August 18, 2014

How to show date next to time in the panel in Ubuntu Gnome

Title

How to show date next to time in the panel (Gnome)

If you might see calendar like as below.

but you can input as below in gnome shell terminal.

$ gsettings set org.gnome.desktop.interface clock-show-date true

and then, you can see like this.

Wednesday, August 13, 2014

Emacs print with color syntax highlighting

Welcome document

You can insert this line as below

(setq ps-paper-type 'letter
ps-font-size 8.0
ps-print-header nil
ps-landscape-mode t
ps-number-of-columns 2)

and than if you run ‘M-x ps-print-buffer-with-faces’, the buffer is printed.

Gnome ubuntu 13.10 한글 설정 (Korean language)

Welcome document

1) $ sudo apt-get install nabi language-selector-gnome
2) System Settings → Language support → Keyboard input method system : Ibus (select it)
3) install Language → korean
4) log out & log in
5) System Settings → Region & Language → Input Sources → add → Korean(Hangul)
6) press ’ Super + space ’ or your key to switch to next source (System Settings → Keyboard → Typing)

Tuesday, August 12, 2014

Simple setting for QT4 development environment

Welcome document

1) $ sudo apt-get install libqt4-core

2) $ sudo apt-get install libqt4-dev

3) $ dpkg -l | grep qt4 Check QT4 development environment

ii  libntrack-qt4-1                       016-1.1                                       amd64        Qt 4 API for ntrack
ii  libpoppler-qt4-4:amd64                0.24.3-0ubuntu1~saucy1                        amd64        PDF rendering library (Qt 4 based shared library)
ii  libqt4-core                           4:4.8.4+dfsg-0ubuntu18.1                      amd64        transitional package for Qt 4 core non-GUI runtime libraries
ii  libqt4-dbus:amd64                     4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 D-Bus module
ii  libqt4-declarative:amd64              4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 Declarative module
ii  libqt4-designer:amd64                 4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 designer module
ii  libqt4-dev                            4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 development files
ii  libqt4-dev-bin                        4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 development programs
ii  libqt4-help:amd64                     4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 help module
ii  libqt4-network:amd64                  4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 network module
ii  libqt4-opengl:amd64                   4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 OpenGL module
ii  libqt4-opengl-dev                     4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 OpenGL library development files
ii  libqt4-qt3support:amd64               4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 3 compatibility library for Qt 4
ii  libqt4-script:amd64                   4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 script module
ii  libqt4-scripttools:amd64              4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 script tools module
ii  libqt4-sql:amd64                      4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 SQL module
ii  libqt4-sql-mysql:amd64                4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 MySQL database driver
ii  libqt4-svg:amd64                      4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 SVG module
ii  libqt4-test:amd64                     4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 test module
ii  libqt4-xml:amd64                      4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 XML module
ii  libqt4-xmlpatterns:amd64              4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 XML patterns module
ii  qt4-linguist-tools                    4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 Linguist tools
ii  qt4-qmake                             4:4.8.4+dfsg-0ubuntu18.1                      amd64        Qt 4 qmake Makefile generator tool

If you can see it as above, it’s completed.

QT4 Development Simple Test

4-1) $ mkdir qt-test

4-2) $ cd qt-test

4-3) $ vi test.cpp

#include <QtCore/QCoreApplication>
 #include <QDebug>

 int main(int argc, char *argv[])
 {
              //QCoreApplication a(argc, argv);
              qDebug() << "hello world!" << endl;
                  //return a.exec();
  }

4-4) $ qmake-qt4 -project Create file ‘qt-test.pro’

4-5) $ qmake-qt4 Create file ‘Makefile’

4-6) $ make make and then you can see binary file ‘qt-test’

4-7) $ ./qt test just run it.

etc : problem & solution

  • a problem : after ‘make’ command
make: Warning: File `/usr/share/qt4/mkspecs/linux-g++/qmake.conf' has modification time 1.4e+09 s in the future
/usr/bin/qmake-qt4 -o Makefile qt.pro
make: Warning: File `/usr/share/qt4/mkspecs/linux-g++/qmake.conf' has modification time 1.4e+09 s in the future
/usr/bin/qmake-qt4 -o Makefile qt.pro
make: Warning: File `/usr/share/qt4/mkspecs/linux-g++/qmake.conf' has modification time 1.4e+09 s in the future
/usr/bin/qmake-qt4 -o Makefile qt.pro
make: Warning: File `/usr/share/qt4/mkspecs/linux-g++/qmake.conf' has modification time 1.4e+09 s in the future
/usr/bin/qmake-qt4 -o Makefile qt.pro
…
repeat output as above.
  • a solution : $ find {directory_name} -exec touch {} \;

I don’t know exactly the reason of this problem but it is about date of system? file?
$ touch /usr/share/qt4/mkspecs/linux-g++/qmake.conf wasn’t able to solve this problem.
So I solved it by the command line which can run ‘touch’ in all of subdirectories as above.

FEC ethernet driver on L4 Linux using Freescale imx6 Quad SABRE SD

Welcome document imx6q-fec.patch was made to load FEC ethernet driver on L4 Linux.
Author: Taeung Song <treeze.taeung@gmail.com>, Yeongchann Han <yeongchann@xsinc.co.kr>
Date:   Tue May 15 17:20:18 2014

This patch is 

to change UART2 to UART1 for imx6q sabresd (learned by Ahmed Ammar) and
to fix compile error(fiasco and l4linux),
to modify source related to FEC ethernet. 

diff -uNr a/src/kernel/fiasco/src/kern/arm/bsp/imx/mem_layout-arm-imx.cpp b/src/kernel/fiasco/src/kern/arm/bsp/imx/mem_layout-arm-imx.cpp
--- a/src/kernel/fiasco/src/kern/arm/bsp/imx/mem_layout-arm-imx.cpp 2014-03-01 02:17:42.000000000 +0900
+++ b/src/kernel/fiasco/src/kern/arm/bsp/imx/mem_layout-arm-imx.cpp 2014-05-15 21:12:50.814787510 +0900
@@ -80,6 +80,6 @@
     Gpt_phys_base        = 0x02098000,
     Src_phys_base        = 0x020d8000,
     Uart2_phys_base      = 0x021e8000, // uart2
-    Uart_phys_base       = Uart2_phys_base,
+    Uart_phys_base       = Uart1_phys_base, //imx6q use UART1
   };
 };
diff -uNr a/src/kernel/fiasco/src/kern/arm/bsp/imx/uart-imx.cpp b/src/kernel/fiasco/src/kern/arm/bsp/imx/uart-imx.cpp
--- a/src/kernel/fiasco/src/kern/arm/bsp/imx/uart-imx.cpp   2014-03-01 02:17:42.000000000 +0900
+++ b/src/kernel/fiasco/src/kern/arm/bsp/imx/uart-imx.cpp   2014-05-16 12:21:50.700017375 +0900
@@ -41,7 +41,8 @@

 #include "uart_imx.h"

-IMPLEMENT int Uart::irq() const { return 59; }
+//imx6q uses UART1 which uses (irq=58)
+IMPLEMENT int Uart::irq() const { return 58; }

 IMPLEMENT L4::Uart *Uart::uart()
 {
diff -uNr a/src/kernel/fiasco/src/kern/tb_entry_output.cc b/src/kernel/fiasco/src/kern/tb_entry_output.cc
--- a/src/kernel/fiasco/src/kern/tb_entry_output.cc 2014-03-01 02:17:42.000000000 +0900
+++ b/src/kernel/fiasco/src/kern/tb_entry_output.cc 2014-05-15 18:00:42.338421257 +0900
@@ -110,6 +110,7 @@
 class Tb_entry_ipc_fmt : public Tb_entry_formatter
 {
 public:
+  Tb_entry_ipc_fmt(){};
   void print(String_buffer *, Tb_entry const *) const {}
   Group_order has_partner(Tb_entry const *) const
   { return Tb_entry::Group_order::first(); }
@@ -126,6 +127,7 @@
 class Tb_entry_ipc_res_fmt : public Tb_entry_formatter
 {
 public:
+  Tb_entry_ipc_res_fmt(){};
   void print(String_buffer *, Tb_entry const *) const {}
   Group_order has_partner(Tb_entry const *) const
   { return Tb_entry::Group_order::last(); }
diff -uNr a/src/l4/conf/examples/imx6q.io b/src/l4/conf/examples/imx6q.io
--- a/src/l4/conf/examples/imx6q.io 1970-01-01 09:00:00.000000000 +0900
+++ b/src/l4/conf/examples/imx6q.io 2014-05-15 22:06:12.586889228 +0900
@@ -0,0 +1,22 @@
+hw-root
+{
+  NIC => new Device()
+  {
+    .hid = "imx6q-fec.0";
+    new-res Mmio(0x02188000 .. 0x0218BFFF);
+    new-res Irq(150);
+    new-res Irq(151);
+  }
+
+  DMAMEM => new Device()
+  {
+    .hid = "dmamem";
+    new-res Mmio_ram(0x80000, 0);
+  }
+}
+
+l4linux => new System_bus()
+{
+  "imx6q-fec.dev" => wrap(hw-root.NIC);
+  "dmamem" => wrap(hw-root.DMAMEM);
+} 
diff -uNr a/src/l4/conf/examples/l4lx-imx6q.cfg b/src/l4/conf/examples/l4lx-imx6q.cfg
--- a/src/l4/conf/examples/l4lx-imx6q.cfg   1970-01-01 09:00:00.000000000 +0900
+++ b/src/l4/conf/examples/l4lx-imx6q.cfg   2014-05-15 22:06:02.202888898 +0900
@@ -0,0 +1,30 @@
+-- vim:set ft=lua:
+
+loader = L4.default_loader;
+vbus_l4linux = loader:new_channel();
+
+local lxname = "vmlinuz";
+if L4.Info.arch() == "arm" then
+  lxname = "vmlinuz.arm";
+end
+
+loader:start(
+{
+   caps = {
+       sigma0  = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0);
+       icu     = L4.Env.icu;
+        l4linux = vbus_l4linux:svr();
+   },
+   log      = { "IO", "y" },
+   l4re_dbg = L4.Dbg.Warn,
+},"rom/io -vvv rom/imx6q.io");
+
+L4.default_loader:start(
+  { caps = {
+      vbus = vbus_l4linux; 
+      log = L4.Env.log:m("rws"),
+    },
+    l4re_dbg = L4.Dbg.Warn,
+    log = { "l4linux", "yellow" },
+  },
+  "rom/" .. lxname .. " mem=64M console=ttyLv0 l4x_rd=rom/ramdisk-" ..  L4.Info.arch() .. ".rd root=1:0 ramdisk_size=4000 ip=dhcp init=/bin/sh");
diff -uNr a/src/l4/conf/modules.list b/src/l4/conf/modules.list
--- a/src/l4/conf/modules.list  2014-03-01 02:17:42.000000000 +0900
+++ b/src/l4/conf/modules.list  2014-05-15 21:53:32.966865095 +0900
@@ -88,6 +88,16 @@
 module vmlinuz.arm
 module ramdisk-arm.rd

+entry L4Linux-imx6q
+roottask moe rom/l4lx-imx6q.cfg
+module l4re
+module ned
+module l4lx-imx6q.cfg
+module io
+module imx6q.io
+module vmlinuz.arm
+module ramdisk-arm.rd
+
 entry L4Linux-mag-x86
 roottask moe rom/l4lx-gfx.cfg
 module l4re
diff -uNr a/src/l4/pkg/bootstrap/server/src/platform/imx.cc b/src/l4/pkg/bootstrap/server/src/platform/imx.cc
--- a/src/l4/pkg/bootstrap/server/src/platform/imx.cc   2014-03-01 02:17:42.000000000 +0900
+++ b/src/l4/pkg/bootstrap/server/src/platform/imx.cc   2014-05-15 21:12:02.030785960 +0900
@@ -37,8 +37,9 @@
     static L4::Io_register_block_mmio r(0x73fbc000);
     static L4::Uart_imx51 _uart;
 #elif defined(PLATFORM_TYPE_imx6)
-    //static L4::Io_register_block_mmio r(0x02020000); // UART1
-    static L4::Io_register_block_mmio r(0x021e8000); // UART2
+    //imx6q use UART1
+    static L4::Io_register_block_mmio r(0x02020000); // UART1
+    //static L4::Io_register_block_mmio r(0x021e8000); // UART2
     static L4::Uart_imx6 _uart;
 #else
 #error Which platform type?
diff -uNr a/src/l4linux/arch/l4/Kconfig b/src/l4linux/arch/l4/Kconfig
--- a/src/l4linux/arch/l4/Kconfig   2014-03-01 02:17:42.000000000 +0900
+++ b/src/l4linux/arch/l4/Kconfig   2014-05-16 15:31:04.448378077 +0900
@@ -63,16 +63,20 @@
    config L4_PLATFORM_GENERIC
        bool "Generic"
        select CLKDEV_LOOKUP
-       select L4_CLK_NOOP
+       select HAVE_CLK_PREPARE
+       select HAVE_MACH_CLKDEV
+       select COMMON_CLK

    config L4_PLATFORM_REALVIEW
        bool "Realview"
        select CLKDEV_LOOKUP
        select OUTER_CACHE
-       select L4_CLK_NOOP

 endchoice

+config L4_CLK_NOOP
+   bool "L4 Clock Noop"
+   depends on (L4_PLATFORM_GENERIC || L4_PLATFORM_REALVIEW)

 menu "Features"

diff -uNr a/src/l4linux/arch/l4/kernel/arch-arm/mach_setup.c b/src/l4linux/arch/l4/kernel/arch-arm/mach_setup.c
--- a/src/l4linux/arch/l4/kernel/arch-arm/mach_setup.c  2014-03-01 02:17:42.000000000 +0900
+++ b/src/l4linux/arch/l4/kernel/arch-arm/mach_setup.c  2014-05-16 12:20:05.428014031 +0900
@@ -5,6 +5,7 @@
 #include <linux/platform_device.h>
 #include <linux/ata_platform.h>
 #include <linux/smsc911x.h>
+#include <linux/fec.h>
 #include <linux/slab.h>
 #include <linux/list.h>

@@ -228,6 +229,74 @@
 }
 #endif

+static struct resource imx6q_fec_resources[] = {
+   {
+       .start = 0x02188000,
+       .end = 0x0218BFFF,
+       .name = "imx6q-fec mem",
+       .flags = IORESOURCE_MEM
+   },
+   {
+       .start = 150,
+       .end = 151,
+       .name = "imx6q-fec irq",
+       .flags = IORESOURCE_IRQ
+   }
+};
+
+static struct fec_platform_data imx6q_fec_pd = {
+   .phy = PHY_INTERFACE_MODE_RGMII
+};
+
+static struct platform_device imx6q_fec_dev = {
+   .name = "imx6q-fec",
+   .id = 0,
+   .resource = imx6q_fec_resources,
+   .num_resources = ARRAY_SIZE(imx6q_fec_resources),
+   .dev = {
+       .platform_data = &imx6q_fec_pd,
+   },
+};
+
+static int ar8031_phy_fixup(struct phy_device *dev)
+{
+   u16 val;
+
+   /* To enable AR8031 output a 125MHz clk from CLK_25M */
+   phy_write(dev, 0xd, 0x7);
+   phy_write(dev, 0xe, 0x8016);
+   phy_write(dev, 0xd, 0x4007);
+
+   val = phy_read(dev, 0xe);
+   val &= 0xffe3;
+   val |= 0x18;
+   phy_write(dev, 0xe, val);
+
+   /* introduce tx clock delay */
+   phy_write(dev, 0x1d, 0x5);
+   val = phy_read(dev, 0x1e);
+   val |= 0x0100;
+   phy_write(dev, 0x1e, val);
+
+   return 0;
+}
+
+#define PHY_ID_AR8031  0x004dd074
+
+static void __init imx6q_enet_phy_init(void)
+{
+   if (IS_BUILTIN(CONFIG_PHYLIB)) {
+       phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff,
+               ar8031_phy_fixup);
+   }
+}
+
+static L4X_DEVICE_CB(imx6q_device_cb_fec)
+{
+   platform_device_register(&imx6q_fec_dev);
+   imx6q_enet_phy_init();
+}
+
 static void register_platform_callbacks(void)
 {
 #ifdef CONFIG_L4_DMAPOOL
@@ -239,6 +308,7 @@
    l4x_register_platform_device_callback("smsc911x",     realview_device_cb_smsc);
    l4x_register_platform_device_callback("aaci",         aaci_cb);
 #endif
+   l4x_register_platform_device_callback("imx6q-fec.dev",imx6q_device_cb_fec);
 }

 static void
diff -uNr a/src/l4linux/drivers/net/ethernet/freescale/fec.h b/src/l4linux/drivers/net/ethernet/freescale/fec.h
--- a/src/l4linux/drivers/net/ethernet/freescale/fec.h  2014-03-01 02:17:42.000000000 +0900
+++ b/src/l4linux/drivers/net/ethernet/freescale/fec.h  2014-05-15 18:31:45.018480434 +0900
@@ -19,7 +19,7 @@

 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
     defined(CONFIG_M520x) || defined(CONFIG_M532x) || \
-    defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28)
+    defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28) || CONFIG_L4
 /*
  * Just figures, Motorola would have to change the offsets for
  * registers in the same peripheral device on different models
@@ -147,7 +147,7 @@
 /*
  * Define the buffer descriptor structure.
  */
-#if defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28)
+#if defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28) || defined(CONFIG_L4)
 struct bufdesc {
    unsigned short cbd_datlen;  /* Data length */
    unsigned short cbd_sc;  /* Control and status info */
diff -uNr a/src/l4linux/drivers/net/ethernet/freescale/fec_main.c b/src/l4linux/drivers/net/ethernet/freescale/fec_main.c
--- a/src/l4linux/drivers/net/ethernet/freescale/fec_main.c 2014-03-01 02:17:42.000000000 +0900
+++ b/src/l4linux/drivers/net/ethernet/freescale/fec_main.c 2014-05-15 18:31:07.446479240 +0900
@@ -60,6 +60,11 @@

 #include "fec.h"

+#ifdef CONFIG_L4
+//ahb clock
+#define clk_get_rate(x)                132000000
+#endif
+
 static void set_multicast_list(struct net_device *ndev);

 #if defined(CONFIG_ARM)
@@ -2138,6 +2143,15 @@
        fep->phy_interface = ret;
    }

+   #ifdef CONFIG_L4
+       //Do no setup Clocks or regulator
+       fep->clk_ahb = NULL;
+       fep->clk_ipg = NULL;
+       fep->clk_enet_out = NULL;
+       fep->clk_ptp = NULL;
+       fep->reg_phy = NULL;
+   #else
+
    fep->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
    if (IS_ERR(fep->clk_ipg)) {
        ret = PTR_ERR(fep->clk_ipg);
@@ -2195,6 +2209,8 @@
        fep->reg_phy = NULL;
    }

+   #endif
+
    fec_reset_phy(pdev);

    if (fep->bufdesc_ex)
diff -uNr a/src/l4linux/drivers/net/ethernet/freescale/fec_ptp.c b/src/l4linux/drivers/net/ethernet/freescale/fec_ptp.c
--- a/src/l4linux/drivers/net/ethernet/freescale/fec_ptp.c  2014-03-01 02:17:42.000000000 +0900
+++ b/src/l4linux/drivers/net/ethernet/freescale/fec_ptp.c  2014-05-15 18:30:38.826478331 +0900
@@ -49,6 +49,9 @@

 #include "fec.h"

+//ahb clock
+#define clk_get_rate(x)                132000000
+
 /* FEC 1588 register bits */
 #define FEC_T_CTRL_SLAVE                0x00002000
 #define FEC_T_CTRL_CAPTURE              0x00000800
diff -uNr a/src/l4linux/drivers/net/ethernet/freescale/Kconfig b/src/l4linux/drivers/net/ethernet/freescale/Kconfig
--- a/src/l4linux/drivers/net/ethernet/freescale/Kconfig    2014-03-01 02:17:42.000000000 +0900
+++ b/src/l4linux/drivers/net/ethernet/freescale/Kconfig    2014-05-15 18:33:37.014483992 +0900
@@ -7,7 +7,7 @@
    default y
    depends on FSL_SOC || QUICC_ENGINE || CPM1 || CPM2 || PPC_MPC512x || \
           M523x || M527x || M5272 || M528x || M520x || M532x || \
-          ARCH_MXC || ARCH_MXS || (PPC_MPC52xx && PPC_BESTCOMM)
+          ARCH_MXC || ARCH_MXS || (PPC_MPC52xx && PPC_BESTCOMM) || L4 
    ---help---
      If you have a network (Ethernet) card belonging to this class, say Y
      and read the Ethernet-HOWTO, available from
@@ -23,7 +23,7 @@
 config FEC
    tristate "FEC ethernet controller (of ColdFire and some i.MX CPUs)"
    depends on (M523x || M527x || M5272 || M528x || M520x || M532x || \
-          ARCH_MXC || SOC_IMX28)
+          ARCH_MXC || SOC_IMX28) || L4 
    default ARCH_MXC || SOC_IMX28 if ARM
    select PHYLIB
    select PTP_1588_CLOCK