首页 > 代码库 > NUC972移植工作记录

NUC972移植工作记录

1

 

自动挂载U盘和SD卡问题的解决:

http://blog.csdn.net/xdw1985829/article/details/6684968

用的mdev的方法。

 

Linux中我们经常用到U盘、SD卡的挂载问题,每次都手动挂载或卸载非常麻烦,我们可以采取以下方法实现自动挂载或卸载U盘、SD

 

@1: 首先在/etc/init.d/rsC中加入以下语句

 

echo /sbin/mdev >/proc/sys/kernel/hotplug

 

@2:/etc/下简历mdev.conf的文件,包含以下内容

sd[a-z][0-9]      0:0 666        @(/etc/hotplug/insert.sh $MDEV$SUBSYSTEM)

sd[a-z]           0:0 666        $(/etc/hotplug/remove.sh $MDEV$SUBSYSTEM)

ub[a-z][0-9]      0:0 666        @(/etc/hotplug/insert.sh $MDEV$SUBSYSTEM)

ub[a-z]           0:0 666       $(/etc/hotplug/remove.sh $MDEV $SUBSYSTEM)

mmcblk[0-9]p[0-9] 0:0 666        @(/etc/hotplug/insert.sh $MDEV$SUBSYSTEM)

mmcblk[0-9]       0:0 666        $(/etc/hotplug/remove.sh $MDEV$SUBSYSTEM)

 

@3:/etc/下建立以下文件夹hotplug,并在hotplug目录下建立以下文件,包含以下内容

 

insert.sh:

if [ -n "$1" ] ; then

   if [ -b /dev/$1 ]; then

       if [ ! -d /mnt/usb/sda1 ]; then

           mkdir -p /mnt/usb/sda1

       fi

       if [ ! -d /mnt/usb/$1 ]; then

           mkdir -p /mnt/usb/$1

       fi

            mount /dev/$1 /mnt/usb/$1

if [ $? -ne 0 ]; then

   rm -rf /mnt/usb/$1

       fi

   fi

fi

remove.sh:

MOUNTS=$(mount | grep $1 | cut -d‘ ‘ -f3)

umount $MOUNTS

rm -rf $MOUNTS

 

SD卡的自动挂载同理:

 

@4:在/etc/下建立以下文件夹hotplug,并在hotplug目录下建立以下文件,包含以下内容

 

insertsd.sh:

 

if [ -n "$1" ] ; then

   if [ -b /dev/$1 ]; then

       if [ ! -d /mnt/mmc/mmcblk0p1 ]; then

           mkdir -p /media

       fi

       if [ ! -d /mnt/mmc/$1 ]; then

           mkdir -p /mnt/mmc/$1

       fi

            mount /dev/$1 /mnt/mmc/$1

if [ $? -ne 0 ]; then

   rm -rf /mnt/mmc/$1

       fi

   fi

fi

 

removesd.sh:

 

MOUNTS=$(mount | grep $1 | cut -d‘ ‘ -f3)

umount $MOUNTS

rm -rf $MOUNTS

 

 

2

 

date 日月时分年.                //设置系统时间

 

hwclock -f /dev/rtc1 -w          //将系统时间写入到/dev/rtc1写到硬件rtc

 

hwclock -f /dev/rtc1 -s              //rtc1的时间同步到系统时间中      从硬件rtc中同步到系统中

 

 

3

 

RTChwclock问题的解决:

 

用的pcf8563驱动

 

arch/arm/mach-nuc970/dev.c

 

将:

 

static struct i2c_board_info __initdatanuc970_i2c_clients0[] =

{

#ifdef CONFIG_SND_SOC_NAU8822

         {I2C_BOARD_INFO("nau8822",0x1a),},

#endif

};

 

改为:

 

static struct i2c_board_info __initdatanuc970_i2c_clients0[] =

{

#ifdef CONFIG_SND_SOC_NAU8822

         //{I2C_BOARD_INFO("nau8822",0x1a),},

#endif

         {I2C_BOARD_INFO("pcf8563",0x51)},                               //添加pcf8563                          

};

 

之后将:

 

#ifdef CONFIG_I2C_BUS_NUC970_P0

         i2c_register_board_info(0,nuc970_i2c_clients0, sizeof(nuc970_i2c_clients0)/sizeof(structi2c_board_info));

#endif

 

改为:

 

#ifdef CONFIG_I2C_BUS_NUC970_P0

         //i2c_register_board_info(1,nuc970_i2c_clients0, sizeof(nuc970_i2c_clients0)/sizeof(struct i2c_board_info));

         i2c_register_board_info(0,nuc970_i2c_clients0, sizeof(nuc970_i2c_clients0)/sizeof(structi2c_board_info));    //我们使用的是I2C0

#endif

 

 

编译内核,看内核中的log信息,来得知pcf8563rtc,是在/dev/rtc1

 

所以操作hwclock操作这个rtc时,要指定文件设备(-f),否则直接hwclock可能是对应的/dev/rtc0 

 

date 月日时分年.

 

hwclock -f /dev/rtc1 -w

 

 

 

4

 

看门狗无法复位的问题:

 

 

硬件电路上没有32.768KHZ的晶振,然而内核中看门狗用的却是这个32.768KHZ晶振提供的时钟源。

 

解决方案两种:

 

第一种:硬件电路上加上这个32.768KHZ的晶振。

 

第二种:软件上,在内核驱动中,读改写了看门狗的时钟来源的寄存器,将其设置为了从PCLK/4096来的时钟源,也就是75MHZ/4096

 

driver/watchdog/nuc970_wdt.c

 

将:

 

static int nuc970wdt_start(structwatchdog_device *wdd)

{

         unsignedint val = 0;

 

         val|= (WTRE | WTE | WTR);

 

         if(wdd->timeout< 2) {

                   val|= 0x5 << 8;

         }else if (wdd->timeout < 8) {

                   val|= 0x6 << 8;

         }else {

                   val|= 0x7 << 8;

         }

         Unlock_RegWriteProtect();

         __raw_writel(val,REG_WDT_CR);

         Lock_RegWriteProtect();

        

         return0;

}

 

修改为:

 

 

static int nuc970wdt_start(structwatchdog_device *wdd)

{

         unsignedint val = 0;

 

         val|= (WTRE | WTE | WTR);

 

         if(wdd->timeout< 2) {

                   val|= 0x5 << 8;

         }else if (wdd->timeout < 8) {

                   val|= 0x6 << 8;

         }else {

                   val|= 0x7 << 8;

         }

//      printk(KERN_INFO"/****************************WDT_START val = 0x%x ************\n", val);//0x783            //why

         Unlock_RegWriteProtect();

         __raw_writel(val,REG_WDT_CR);

         __raw_writel((__raw_readl(REG_CLK_DIV8)& (~0x300)) | 0x200, REG_CLK_DIV8);            //why  PCLK/4096           //设置看门狗的时钟源

         Lock_RegWriteProtect();

        

         return0;

}

 

将:

static int nuc970wdt_probe(structplatform_device *pdev)函数中的

 

         nuc970_wdd.timeout= 2;                 // default time out =2 sec (2.03)

         nuc970_wdd.min_timeout= 1;

         nuc970_wdd.max_timeout= 9;       // max time out = 9 sec (8.03)

        

修改成:

 

//nuc970_wdd.timeout = 2;              // default time out = 2 sec (2.03)

         nuc970_wdd.timeout= 8;                          //why

         nuc970_wdd.min_timeout= 1;        // min time out = 1 sec (0.53)

         //nuc970_wdd.max_timeout= 9;   // max time out = 9 sec (8.03)

         nuc970_wdd.max_timeout= 14;                       //why

 

 

        

5Qt移植

 

./configure -prefix /usr/local/qt4.8.3-arm-embedded arm -release -shared -fast -no-largefile -qt-sql-sqlite -qt3support-no-xmlpatterns -no-glib -no-phonon -no-mmx -no-3dnow -no-sse -no-sse2 -no-svg-webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg -make libs -nomake examples-nomake docs -nomake demo -no-nis -no-cups -iconv -no-dbus -openssl -xplatformqws/linux-arm-g++ -little-endian -qt-freetype -depths 16,24,32 -qt-gfx-linuxfb-qt-gfx-transformed -qt-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb-qt-kbd-linuxinput -no-kbd-qvfb -armfpa -no-mouse-qvfb -qt-mouse-linuxtp-qt-mouse-tslib -DQT_QLOCALE_USES_FCVT -I/usr/local/arm/tslib/include -L/usr/local/arm/tslib/lib-confirm-license

 

echo yes | ./configure -prefix/usr/local/qt4.8.3-arm -release -no-largefile -opensource -embedded arm -stl-qt-freetype -qt-sql-sqlite -no-qt3support -no-svg -no-xmlpatterns-no-phonon-backend -no-scripttools -no-phonon -no-script -no-audio-backend-no-multimedia -no-openssl -nomake tools -nomake examples -nomake demos -nomakedocs -xplatform qws/linux-arm-g++ -no-webkit -no-qvfb -no-cups -no-neon-qt-gfx-vnc -no-gfx-multiscreen -qt-kbd-tty -qt-gfx-transformed -no-libtiff-no-libmng -qt-libpng -qt-mouse-pc -no-mouse-linuxtp -qt-mouse-tslib

 

 

 

 

 

 


本文出自 “whylinux” 博客,谢绝转载!

NUC972移植工作记录