2014年4月

Debian wheezy下安装LTIB问题

1.编译wget时出现 gen

sslfunc.c:(.text+0x351): undefined reference to `SSLv2client_method'

解决方法:在文件ltib/dist/lfs-5.1/wget/wget.spec中增加--without-ssl,不编译ssl相关代码

LTIB "Failed building wget" undefined reference to `SSLv2clientmethod'

2.编译sparse时出现 parse.h:63:22: error: duplicate member 'label_statement'

解决:删掉label arg结构体即可,为了方法做成patch文件,加入spec文件,让其自动应用且编译。

ltib breaks up due to parse.h:63:22

3.编译时出现elftosb fatal error: /usr/include/sys/types.h

解决:libc6-dev中有types.h文件,但目录在/usr/include/i386-linux-gnu/sys/types.h,所以创建一个软链接到/usr/include/sys就可以了。

a2sd的相关参数

a2sd check : Checks a2sd status; displays information incl. where your apps, cahce and data are stored.
a2sd cachesd : Moves dalvik cache to sd-ext partition.
a2sd nocache : Moves dalvik cache back to internal storage.
a2sd datasd : Move /data/data to /sd-ext/data .
a2sd nodata : Move /sd-ext/data back to internal storage.
a2sd remove : Moves apps back to internal storage and sets no a2sd flag.

[翻译]CronMod带来的选择A2SD, D2EXT, INT2EXT

原文:

http://www.xda-developers.com/android/cronmod-gives-users-options-of-a2sd-d2ext-int2ext/

很长一段时间里,android的使用者都很享受由A2SD带来的优点,通过将应用安装在SD上,来解决手机内部Flash容量小的问题。现在,新的手机已经拥有再大的存储器容量,内部存储器容量不再成为大难题。However, users still enjoy not having that space taken up by all their applications.自从A2SD被开发出来后,开发者们用不同的方法编写很多脚本来解决同样的问题。目前有A2SD+,A2SD++,INT2EXT,D2EXT等,还有其他一些。现在,root后的android用户使用一个CronMod的脚本,实现所有这些。

脚本的开发者是XDA高级会员croniccorey,它给用户提供了更多可能来管理内部和外部flash。每一种都是一个工作方式,因此用户可以以他们自己的需要来使用。croniccorey解释不同的工作方式:

A2SD 
-Moves /data/app to /sd-ext
-Moves /data/app-private to /sd-ext
-Works with EXT 2/3/4 filesystems
-ZipAligns /data/app on every boot -No symlinks

A2SD+
-Moves /data/app to /sd-ext
-Moves /data/app-private to /sd-ext
-Moves /data/dalvik-cache to /sd-ext
-Works with EXT 2/3/4 filesystems
-ZipAligns /data/app on every boot
-No symlinks

A2SD++
-Moves /data/app to /sd-ext
-Moves /data/app-private to /sd-ext
-Moves /data/dalvik-cache to /sd-ext
-Moves /data/data to /sd-ext
-Works with EXT 2/3/4 filesystems
-ZipAligns /data/app on every boot
-No symlinks

D2EXT
-Mounts /data to /data_internal and /sd-ext to /data
-Works with EXT 2/3/4 filesystems
-ZipAligns /data/app on every boot

D2EXT+
-Mounts /data to /data_internal and /sd-ext to /data
-Leaves /data/dalvik-cache on internal for speed
-Works with EXT 2/3/4 filesystems
-ZipAligns /data/app on every boot

INT2EXT
-Mounts /sd-ext to /data
-Works with EXT 2/3/4 filesystems
-ZipAligns /data/app on every boot
-No symlinks
-First universal INT2EXT method

INT2EXT+
-Mounts /sd-ext to /data
-Leaves /data/data on internal for speed
-Works with EXT 2/3/4 filesystems
-ZipAligns /data/app on every boot
-No symlinks
-First universal INT2EXT method

当用户可以从众多方式中选择时,不会有任何麻烦。此外,croniccorey还发布了一个开发者版本,它被包含在ROM中(前提是可以信任的)。使用者的手机中的ROM应支持init.d,同时必须将系统root。从上面的方式中,选择一种最适合你的吧。

cronicorey CronMod

LDD读书笔记3

现在已经有很多驱动支技sysfs,实现与设备交互的功能,用户空间借用echo,cat命令即可操作相应设备。sysfs提供统一的文本格式,也就是属性文件。一个属性文件代表一个属性值,可读可写。属性值结构的表示如下:
struct attribute
{
char∗ name;
struct module ∗owner;
mode_t mode;
};

这里的name也是sysfs下的属性文件的名称。对属性的读写通过两个函数完成,sysfs中称为show和store。
struct device_attribute
{
struct attribute attr;
ssize_t (∗show)(struct device ∗dev, char ∗buf);
ssize_t (∗store)(struct device ∗dev, const char ∗buf, size_t count);
};

int device_create_file(struct device ∗device, struct device_attribute ∗entry);
void device_remove_file(struct device ∗dev, struct device_attribute ∗attr);

填充好attribute结构体后,实现相关的store和show函数,最后创建属性文件即可。这里有属性的静态创建方法:
#define DEVICE_ATTR(_name, _mode, _show, _store) \
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)


下面是增加sysfs属性文件的led驱动程序:
#include
#include
#include
#include
#include
#include
#include
#include

#define GPB_CON 0x56000010
#define GPIO_OUTPUT 0x1
#define GPB_DATA 0x4

#define LED_SZ 0x8

dev_t devt;
struct cdev leds_cdev =
{
.owner = THIS_MODULE,
};
struct class *leds_class;
struct device *leds_device;
void *config_base;
void *data_base;

int leds_buf = 0;

struct resource led_res[] =
{
[0] = {
.start = GPB_CON,
.end = GPB_CON + LED_SZ - 1,
.flags = IORESOURCE_MEM,
.name = "led_res",
},
};

void led_release(struct device *dev)
{
printk(KERN_ALERT "Device is released\n");
}

struct platform_device dev = {
.name = "micro2440-led",
.id = -1,
.num_resources = ARRAY_SIZE(led_res),
.resource = led_res,
.dev = {
.release = led_release,
}
};

ssize_t leds_write(struct file *filp, const char *buf, size_t len, loff_t *offset)
{
int tmp = 0;
if(len > sizeof(leds_buf))
return -1;
if(copy_from_user(&leds_buf, buf, len)){
printk(KERN_ALERT "write error\n");
return -2;
}

if(leds_buf > 0){
// turn on the leds
tmp = ioread32(config_base + GPB_DATA);
tmp &= ~((1 << 5) | (1 << 6) | (1 << 7) | (1 << 8));
iowrite32(tmp, config_base + GPB_DATA);

}else{
// turn off the leds

tmp = ioread32(config_base + GPB_DATA);
tmp |= (0x1 << 5) | (0x1 << 6) | (0x1 << 7) | (0x1 << 8);
iowrite32(tmp, config_base + GPB_DATA);

}

return len;
}


static void led_ops(unsigned int sw){
int tmp = 0;

if(sw){
// turn on the leds
tmp = ioread32(config_base + GPB_DATA);
tmp &= ~((1 << 5) | (1 << 6) | (1 << 7) | (1 << 8));
iowrite32(tmp, config_base + GPB_DATA);

}else{
// turn off the leds

tmp = ioread32(config_base + GPB_DATA);
tmp |= (0x1 << 5) | (0x1 << 6) | (0x1 << 7) | (0x1 << 8);
iowrite32(tmp, config_base + GPB_DATA);
}
}

static ssize_t led_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return printk("write a number in to led\n");
}

static ssize_t led_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
unsigned int value;

sscanf(buf, "%d", &value);
//printk("the string is %s, %d\n", buf, value);
if(value)
led_ops(1);
else
led_ops(0);

return 1;
}

struct file_operations leds_fops =
{
.owner = THIS_MODULE,
.write = leds_write,
};

static DEVICE_ATTR(led_state, S_IRUGO | S_IWUSR, led_show, led_store);


int led_probe(struct platform_device *pdev)
{
int ret;
unsigned long tmp;
struct resource *res;

ret = device_create_file(&pdev->dev, &dev_attr_led_state);

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if(!res)
return -EBUSY;


ret = alloc_chrdev_region(&devt, 0, 1, "leds");
if(ret){
printk(KERN_ALERT "alloc devt error\n");
goto ERR1;
}

cdev_init(&leds_cdev, &leds_fops);

ret = cdev_add(&leds_cdev, devt, 1);
if(ret){
printk(KERN_ALERT "add cdev error\n");
goto ERR2;
}

leds_class = class_create(THIS_MODULE, "leds");

leds_device = device_create(leds_class, NULL, devt, NULL, "leds");
if(leds_device == NULL){
printk(KERN_ALERT "create dev node error\n");
goto ERR3;
}

config_base = ioremap(res->start, res->end - res->start + 1);
if(config_base == NULL){
printk(KERN_ALERT "map io error\n");
goto ERR4;
}


tmp = ioread32(config_base);
tmp |= (GPIO_OUTPUT << 10) | (GPIO_OUTPUT << 12) | (GPIO_OUTPUT << 14) | (GPIO_OUTPUT << 16);
iowrite32(tmp, config_base);

printk(KERN_ALERT "leds init success\n");
return 0;

ERR4:
release_resource(led_res);
ERR3:
cdev_del(&leds_cdev);
ERR2:
unregister_chrdev_region(devt, 1);
ERR1:
return -1;
}

int led_remove(struct platform_device *pdev)
{
iounmap(config_base);

device_remove_file(&pdev->dev, &dev_attr_led_state);
device_destroy(leds_class, devt);
class_destroy(leds_class);

cdev_del(&leds_cdev);
unregister_chrdev_region(devt, 1);

return 0;
}

struct platform_driver drv = {
.probe = led_probe,
.remove = led_remove,
.driver = {
.name = "micro2440-led"
}
};

static int __init leds_init(void)
{
platform_device_register(&dev);
platform_driver_register(&drv);

return 0;
}

static void __exit leds_exit(void)
{

platform_driver_unregister(&drv);
platform_device_unregister(&dev);

printk(KERN_ALERT "leds has been exited\n");
}

module_init(leds_init);
module_exit(leds_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Blackrose");


Resource Links:
sysfs https://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf
http://www.makelinux.net/ldd3/chp-14-sect-2
Linux理解devfs、sysfs、udev http://www.mike.org.cn/articles/linux-understand-devfs-sysfs-udev/
https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt

最新文章

最近回复

  • Blackrose: 感谢拍砖!嗯,那句话...
  • aa: “Raspberry...
  • Blackrose: 外部只是帮你把芯片启...
  • : 内部时钟比外部的频率...
  • Blackrose: 你这评论比正文更有内容么
  • 7hao: CR+LF ...
  • Blackrose: 可以是你更新软件源后...
  • sxk: 博主,我的系统是ub...
  • Blackrose: 你深得精髓么
  • qihao: 这篇文章的简单总结就...

分类

归档

其它