2016年12月6日 星期二

Linux 的網路連線設定

source:
http://askubuntu.com/questions/760871/network-settings-fail-for-ubuntu-xenial64-vagrant-box

Actually, additionally to Maximes answer, you could change the GRUB commandline in your box until the new version is propagated.
Just go to /etc/default/grub and set the appropriate line to GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0" You have to change the /etc/network/interfacesto reflect the correct names (eth0...)
source:

$ edit /etc/network/interfaces

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
# automatically added when upgrading
auto lo
iface lo inet loopback

# The first network card - this entry was created during the Debian installation
# (network, broadcast and gateway are optional)
# automatically added when upgrading
auto eth0
iface eth0 inet static
        address 211.21.247.10
        netmask 255.255.255.248
        network 211.23.247.8
        broadcast 211.23.247.15
        gateway 211.23.247.9

$ /etc/init.d/networking stop         # 停掉網路裝置
$ ifconfig                            # 你會發現空空如也
$ /etc/init.d/networking start        # 啟動網路裝置
$ ifconfig                            # 網路裝置回覆 
$ route -n                            # 網路裝置回覆 

错误“Error found when loading /root/.profile”解决

source:
http://blog.sina.com.cn/s/blog_68b1e07d0102vcqd.html



在刚修改完root权限自动登录后,发现开机出现以下提示:
Error found when loading /root/.profile
stdin:is not a tty
…………
解决方法:在终端中用命令gedit /root/.profile,打开文件后找到“mesg n”,
将其更改为“tty -s && mesg n”。

sudo do-release-upgrade 更新ubuntu

source:

http://stackoverflow.com/questions/30316812/ubuntu-apt-get-unable-to-fetch-packages


I tried using :
sudo do-release-upgrade
and then use :
sudo apt-get update
after that you will be able to install any packages.

If this did not worked for you try to change the network conf in apt.conf

2016年11月21日 星期一

libmp4v2 新project在make修改注意

1. 沒有 configure
2.需要由 configure.ac 來產生 configure
#autoconf configure.ac
error: possibly undefined macro: AC_PROG_LIBTOOL
=> 需要安裝 : libtool
=> apt-get install libtool (failed)
=> 下載libtoolXXX.tar.gz 來安裝(我是找最新版本)
source:
https://ftp.gnu.org/gnu/libtool/
https://www.gnu.org/software/libtool/

>> ./configure
>> make clean && make
>> make install (相關檔案拷貝至/usr/share/local)

==
- make 過程會缺一些tool,閉缺逐一安裝
- makeinfo:
source: 要安裝 texinfo
http://ftp.ntu.edu.tw/gnu/texinfo/

- help2man
source:
http://ftp.ntu.edu.tw/gnu/texinfo/

- aclocal-1.15
source: 找相關版本安裝
https://ftp.gnu.org/gnu/automake/

[question]mv: cannot stat ‘t-cs.gmo’: No such file or directory
>> autoreconf --install.

[question]configure 已產生,執行也沒問題,但執行make會出現~
help2man: can't get `--help' info from ./mp4art
Try `--no-discard-stderr' if option outputs to stderr

解決方法:
/libmp4v2xxxx/doc/GNUmakefile.mk
line 64 =>
HELP2MAN.flags = -m "$(PROJECT_name) Utilities" -N --no-discard-stderr





2016年11月14日 星期一

ARM移植MP4V2

source:
http://blog.csdn.net/xiaoguochang/article/details/8513833

source2:
http://blog.csdn.net/pb09013037/article/details/39498029

下載mp4v2:
https://code.google.com/archive/p/mp4v2/downloads

GNUmakefile說明:
http://www.cc.ntut.edu.tw/~yccheng/oop2005f/GNUMakeManual.pdf


1、./configure --prefix=/home/linux/workspace/mp4v2-build --host=arm  CC=arm-linux-gcc CXX=arm-linux-g++
2、make
3、make install
4、在这个目录下/home/linux/workspace/mp4v2-build,可以查看到编译生成的文件

==
./configure --prefix=/home/jeff/workspace/mp4v2-2.0.0_mod_g711/ --host=arm-unknown-linux-uclibcgnueabi CC=/usr/src/arm-linux-3.3/toolchain_gnueabi-4.4.0_ARMv5TE/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc CXX=/usr/src/arm-linux-3.3/toolchain_gnueabi-4.4.0_ARMv5TE/usr/bin/arm-unknown-linux-uclibcgnueabi-g++
make clean
執行完configure後,會產生GNUmakefile,ㄎ
之後需要先make clean
再 make 誠能成功

結果 ==>
./.libs/libmp4v2.a

make: Nothing to be done for `all' 解决方法

source:
http://www.cnblogs.com/Arlen/articles/1756636.html
==
1.这句提示是说明你已经编译好了,而且没有对代码进行任何改动。
若想重新编译,可以先删除以前编译产生的目标文件:
make clean
然后再
make
 
2.出现这种情况解决方法:

a.make clean 清除安装时留下的文件

b.在运行一下ldconfig

2015年11月3日 星期二

enable_irq_wake是如何起作用的

source:
http://blog.csdn.net/njuitjf/article/details/21475405


enable_irq_wake是如何起作用的
在linux kernel中,调用enable_irq_wake函数,可以将一个irq具有唤醒系统的功能,即把系统从低功耗模式中唤醒,如从suspend to RAM中唤醒。
enable_irq_wake具体如何起作用的呢,今天来学习学习。
先从函数enable_irq_wake开始,实现很简单:

  1. static inline int enable_irq_wake(unsigned int irq)  
  2. {  
  3.  return irq_set_irq_wake(irq, 1);  
  4. }  


函数irq_set_irq_wake的实现也不是很复杂,并且有注释说明,容易理解:

  1. /** 
  2.  * irq_set_irq_wake - control irq power management wakeup 
  3.  * @irq: interrupt to control 
  4.  * @on: enable/disable power management wakeup 
  5.  * 
  6.  * Enable/disable power management wakeup mode, which is 
  7.  * disabled by default.  Enables and disables must match, 
  8.  * just as they match for non-wakeup mode support. 
  9.  * 
  10.  * Wakeup mode lets this IRQ wake the system from sleep 
  11.  * states like "suspend to RAM". 
  12.  */  
  13. int irq_set_irq_wake(unsigned int irq, unsigned int on)  
  14. {  
  15.  unsigned long flags;  
  16.  struct irq_desc *desc = irq_get_desc_buslock(irq, &flags);  
  17.  int ret = 0;  
  18.   
  19.  if (!desc)  
  20.   return -EINVAL;  
  21.   
  22.  /* wakeup-capable irqs can be shared between drivers that 
  23.   * don't need to have the same sleep mode behaviors. 
  24.   */  
  25.  if (on) {  
  26.   if (desc->wake_depth++ == 0) {  
  27.    ret = set_irq_wake_real(irq, on);  
  28.    if (ret)  
  29.     desc->wake_depth = 0;  
  30.    else  
  31.     irqd_set(&desc->irq_data, IRQD_WAKEUP_STATE);  
  32.   }  
  33.  } else {  
  34.   if (desc->wake_depth == 0) {  
  35.    WARN(1"Unbalanced IRQ %d wake disable\n", irq);  
  36.   } else if (--desc->wake_depth == 0) {  
  37.    ret = set_irq_wake_real(irq, on);  
  38.    if (ret)  
  39.     desc->wake_depth = 1;  
  40.    else  
  41.     irqd_clear(&desc->irq_data, IRQD_WAKEUP_STATE);  
  42.   }  
  43.  }  
  44.  irq_put_desc_busunlock(desc, flags);  
  45.  return ret;  
  46. }  


其中关键的代码是计数:desc->wake_depth++, 以及调用函数set_irq_wake_real。
set_irq_wake_real函数调用到了具体cpu相关的代码:

  1. static int set_irq_wake_real(unsigned int irq, unsigned int on)  
  2. {  
  3.  struct irq_desc *desc = irq_to_desc(irq);  
  4.  int ret = -ENXIO;  
  5.   
  6.  if (desc->irq_data.chip->irq_set_wake)  
  7.   ret = desc->irq_data.chip->irq_set_wake(&desc->irq_data, on);  
  8.   
  9.  return ret;  
  10. }  


irq_set_wake为cpu相关代码。
例如,xxx cpu对应的arch\arm\mach-xxx\Irq.c文件中,xxx_init_irq函数中有如下语句:

  1. desc->irq_data.chip->irq_set_wake = xxx_gic_irq_set_wake;  


xxx_gic_irq_set_wake的实现将irq mask,结果保存在一个数组中gpc_wake_irq。
cpu在做power on/off时会使用到该数组。
如mach-xxx\system.c中的函数xxx_cpu_lp_set中有如下代码:

  1. gpc_set_wakeup(gpc_wake_irq);  


函数gpc_set_wakeup的实现:

  1. void gpc_set_wakeup(unsigned int irq[4])  
  2. {  
  3.  /* Mask all wake up source */  
  4.  __raw_writel(~irq[0], gpc_base + 0x8);  
  5.  __raw_writel(~irq[1], gpc_base + 0xc);  
  6.  __raw_writel(~irq[2], gpc_base + 0x10);  
  7.  __raw_writel(~irq[3], gpc_base + 0x14);  
  8.   
  9.  return;  
  10. }  


将irq mask设置到了cpu中。
中cpu的suspend enter函数中,会调用xxx_cpu_lp_set函数。
如xxx_suspend_enter函数中有如下代码:

  1. switch (state) {  
  2. case PM_SUSPEND_MEM:  
  3.  ...  
  4.  mxc_cpu_lp_set(ARM_POWER_OFF);  
  5.  arm_pg = true;  
  6.  break;  
  7. ...  
  8. }  



至此,流程基本清晰了。
enable_irq_wake函数会将irq mask到一个数组。
在进入suspend时,会将irq mask写入到cpu。
也就是告诉cpu哪些irq可以将其从睡眠中唤醒。