内核/drivers/video/samsung/s3c_mini10.c #define S3CFB_VRES 240 #define S3CFB_HRES 320
竖屏
FriendlyARM.ini
#define CONFIG_CMDLINE \"console=ttySAC0,115200 fbcon=rotate:3\"
内核配置
/device drivers/Graphics support/Console display driver support/framebuffer console rotation
Android 文件系统旋转 文件系统/init.rc Setprop ro.sf.hwrotation 90
LOGO
制作logo的方法:
首先选择一个自己喜欢的图片,然后通过GIMP软件将该图片保存为.png格式, 变换方式这个就不说了(very easy),比如保存为linuxlogo.png.
然后将该图片传入到装有Linux PC比如(ubuntu),按照以下顺序你就可以制作一个你喜欢logo
前提你必须安装以下的工具(pngtopnm,pnmquant,pnmtoplainpnm)
$ pngtopnm linuxlogo.png > linuxlogo.pnm $ pnmquant 224 linuxlogo.pnm > linuxlogo224.pnm $ pnmtoplainpnm linuxlogo224.pnm > linuxlogo224.ppm
或者
$bmptoppm pic.bmp > temp1.ppm //生成ppm
$ppmquant 224 temp1.ppm > temp2.ppm //转换成224颜色 $pnmnoraw temp2.ppm > logo.ppm //转换成ascii格式
这样您制作的logo就已经成功了,将linuxlogo224.ppm
拷贝到/drivers/video/logo文件夹中的根据你的平台具体使用的哪个logo进行命名, 由与我用的是RedHat linux,所以我取的名字为logo_linux_clut224.ppm,友情提醒将原有的logo保存。
这样你的logo就完全制作好了,但是有这一点还是不够的,你必须在内核中选择logo,接下来我们来看如何配置内核
去掉logo跟前的光标
在内核的当前目录进入到drivers/video/console/fbcon.c文件 将static void fb_flashcursor(void *private)制成空函数如下
386 static void fb_flashcursor(void *private) 387 {
388 #if 0 //modify by yejj for clear cursor of lcdc
3 struct fb_info *info = private;
390 struct fbcon_ops *ops = info->fbcon_par; 391 struct display *p;
392 struct vc_data *vc = NULL; 393 int c; 394 int mode; 395
396 acquire_console_sem(); 397 if (ops && ops->currcon != -1) 398 vc = vc_cons[ops->currcon].d; 399
400 if (!vc || !CON_IS_VISIBLE(vc) ||
401 registered_fb[con2fb_map[vc->vc_num]] != info ||
402 vc->vc_deccm != 1) { 403 release_console_sem(); 404 return; 405 } 406
407 p = &fb_display[vc->vc_num]; 408 c = scr_readw((u16 *) vc->vc_pos);
409 mode = (!ops->cursor_flash || ops->cursor_state.enable) ? 410 CM_ERASE : CM_DRAW;
411 ops->cursor(vc, info, mode, softback_lines, get_color(vc, info, c, 1), 412 get_color(vc, info, c, 0)); 413 release_console_sem(); 414 #endif 415 }
同样的方法将函数static void fbcon_cursor(struct vc_data *vc, int mode)用空函数替换如下
1304 static void fbcon_cursor(struct vc_data *vc, int mode) 1305 {
1306 #if 0 //modify by yejj for clear cursor of lcdc
1307 struct fb_info *info
./hello not found
奋战半月有余,终于建起了开发平台,以第一个“Hello World”入门程序开始,兴奋之余却遇到bin/sh: hello :not found拦路虎,郁闷啊~~~网上说法云云,改了kernel,又改rootfs,瞎忙一通无济啊,不过还是被我的鼠眼瞄到了,嘿嘿~~~
Build Options->
Build BusyBox as a static binary (no shared libs)
Build with Large File Support (for accessing file>2GB)
如果选择 Build BusyBox as a static binary (no shared libs) 方式进行编译时,所需的库已经与程序静态地链接在一起,这些程序不需要额外的库就可以单独运行,但是自己编写的程序在文件系统上运行必须采用静态编译,否则会报诸如:bin/sh: hello :not found的错误。
静态编译如:
arm-linux-gcc –static hello.c –o hello
串口驱动路径
/drivers/serial/samsung.c
3.5寸 触摸屏 driver/input/touchscreen/ts-if.c
在_ioctl()函数中添加
3.5寸 LCD driver/video/samsung/s3c_mini10.
#define S3CFB_LCD_TYPE #define S3CFB_VBP #define S3CFB_VFP #define S3CFB_VSW #define S3CFB_HBP #define S3CFB_HFP #define S3CFB_HSW
#define S3CFB_HRES
320 /* horizon pixel x resolition */
\"X35\"
( 0x12) /* back porch */ ( 0x2) /* front porch */ (0x03) /* vsync width */ ( 0x40) /* back porch */ ( 0x10) /* front porch */ (0x1e) /* hsync width */
#define S3CFB_VRES
240 /* line cnt y resolution */ 20 /* ~6.34 MHz */
(S3C_VIDCON1_IHSYNC_NORMAL|
#define S3CFB_CLKVAL #define S3CFB_VIDCON1
S3C_VIDCON1_IVSYNC_NORMAL|S3C_VIDCON1_IVDEN_NORMAL)
内核配置 device driver/Graphics support / select LCD type /3.5 inch 240*320 LCD (ACX502BMU)
键盘驱动移植(把飞灵开发板的键盘驱动移植到友善开发板) 键值定义文件 /include/linux/input.h
1. 从飞灵源代码(/drivers/input/keyboard)中拷贝s3c-keypad.c s3c-keypad.h,放到友
善源代码中(/drivers/input/keyboard)
2. 修改该路径下(/drivers/input/keyboard)的Makefile, Kconfig文件
3. 在mach-mini10.c(/arch/arm/mach-s3cxx)文件中,定义键盘设备资源、并添加键盘设
备资源。 定义设备资源: /* Keypad interface */
static struct resource s3c_keypad_resource[] = { };
struct platform_device s3c_device_keypad = { };
EXPORT_SYMBOL(s3c_device_keypad); 添加设备资源
在static struct platform_device *mini10_devices[] __initdata的定义中添加 &s3c_device_keypad
在map.h(/arch/arm/mach-s3cxx/include/mach)文件中添加宏定义 //#define S3CXX_PA_KEYPAD 0x7e00a000
.name .id
= \"s3c-keypad\ = -1,
= s3c_keypad_resource,
[0] = { }, [1] = { }
.start = IRQ_KEYPAD, .end = IRQ_KEYPAD, .flags = IORESOURCE_IRQ, .start = S3C_PA_KEYPAD,
.end = S3C_PA_KEYPAD+ S3C_SZ_KEYPAD - 1, .flags = IORESOURCE_MEM,
.num_resources = ARRAY_SIZE(s3c_keypad_resource), .resource
#define S3CXX_SZ_KEYPAD SZ_4K #define S3C_PA_KEYPAD S3CXX_PA_KEYPAD #define S3C_SZ_KEYPAD S3CXX_SZ_KEYPAD 添
加
键
盘
IO
口
初
始
化
函
数
s3c_setup_keypad_cfg_gpio
(/arch/arm/mach-s3cxx/mach-s3cxx.c)
void s3c_setup_keypad_cfg_gpio(int rows, int columns) { }
内核竖屏: fbcon=rotate:3 文件系统竖屏:
Android裁剪
/* Set all the necessary GPL pins to special-function 0 */ for (gpio = S3CXX_GPL(0); gpio < end; gpio++) { }
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); end = S3CXX_GPL(0 + columns); //end = S3CXX_GPL(3 + 5);//columns);
// Set all the necessary GPK pins to special-function 0 for (gpio = S3CXX_GPK(8); gpio < end; gpio++) { }
s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
printk(\"[KEY]Initialize the GPIO for keybord of ARMSYS10.\"); end = S3CXX_GPK(8 + rows); //end = S3CXX_GPN(0+2);//rows); unsigned int gpio; unsigned int end;
自行编译 Android 2.3 的源代码,编译成功后,执行 genimages.sh 会生成三个 ubi 的文件系统映象, 其中, rootfs_android_clean.ubi 是一个相对精简的文件系统,大家可以试试
SPI驱动移植 添加设备资源
在mach-mini10.c(/arch/arm/mach-s3cxx)文件中,添加SPI设备资源
将 &s3cxx_device_spi1,加入到mini10_devices结构中,就可以将设备s3cxx-spi.1进行初始化
s3cxx_device_spi1结构中的片选数量和时钟并未定义
在函数mini10_machine_init()的最后添加 s3cxx_spi_set_info(1,0,1); spi_board_info 是spi总线上从设备的定义 先在mach-mini10.c中增加如下代码
static void cs_set_level(unsigned line_id, int lvl) { gpio_direction_output(line_id, lvl); };
static struct s3cxx_spi_csinfo s3cxx_spi1_csinfo = { .fb_delay=100,
.line=S3CXX_GPC(7), .set_level=cs_set_level, };
static struct spi_board_info s3c10_spi1_board[] = { [0] = {
.modalias = \"spidev\
.bus_num= 1,//代表使用芯片的第二个spi模块
.chip_select= 0, //必须小于s3c10_spi1_platdata.num_cs .irq = IRQ_SPI1,
.max_speed_hz = 500*1000,
.mode=SPI_MODE_0,
.controller_data=&s3cxx_spi1_csinfo, },
};
为什么要定义s3cxx_spi1_csinfo?这是spi从设备必须的片选信号的定义,片选信号中有一个关键的函数set_level需要各位自己进行定义,这个函数由系统在打开设备时调用,即设置该SPI从设备的片选信号
最后在函数 mini10_machine_init中,增加如下代码
spi_register_board_info(s3c10_spi1_board, ARRAY_SIZE(s3c10_spi1_board)); 这段代码必须加在
s3cxx_spi_set_info(1,0,1);之后,
/arch/arm/mach-s3cxx/Kconfig
在config MACH_MINI10 下面 添加 select S3CXX_DEV_SPI Make menuconfig /Device Drivers/SPI support Y
/Device Drivers/SPI support/Samsung S3CXX series type SPI Y
/Device Drivers/SPI support/User mode SPI device driver support Y Nec LCD
内核代码:使用N43的驱动代码 共修改了三个文件,添加了一个文件。 /drivers/video/samsung 修改文件: S3cfb.h S3cfb_spi.c S3c_mini10.h
添加文件 S3cfb_spi.h
// 修改触摸屏 /driver/input/touchscreen/ts-if.c #define S3CFB_VERS 272 #define S3CFB_VERS 0
Android删除不需要的应用软件
在android-2.3目录下,运行./genimages.sh 注意:genimages.sh文件已做了修改
在android系统中,具体要删除哪个应用软件,详见/android-2.3/genrootfs.sh文件
删去触摸屏校准
修改配置文件(FriendlyARM.ini) 把init=/linuxrc,替换成init=/init
如何在内核源代码中查看内核版本
发现源码的版本号就定义在Makefile的最开头, 内核/makefile andr1.0的kernel版本是 VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 25 EXTRAVERSION =
NAME = Funky Weasel is Jiggy wit it
EXTRAVERSION 没有就是第1版,官方的linux2.6.25.1的EXTRAVERSION也是空的, 所以andr1.0应该是基于linux2.6.25.1
修改android内核版本
修改build.prop(/android2.3/out/target/product/mini10/system/build.prop) Model number 对应代码中 ro.product.model
Android version 对应代码中 ro.build.version.realse Build number 对应代码中 ro.build.display.id
Ro.product.locale.language=zh Ro.product.locale.region=CN 这样开机第一次锁屏的时候就时中文
Kernel version 对应代码中 内核源码(/include/config/kernel.release)
kernel.release,是makefile时生成的,它依赖于内核(/include/config/auto.conf CONFIG_LOCALVERSION)
搜狗输入法
把APK文件放在/out/target/product/mini10/data/app/下,重新生成目录、镜像
产品序列号
用USB线连接开发板与电脑,在电脑的命令行输入 adb devices, 查看产品序列号 修改产品序列号(/arch/arm/mach-s3cxx/mach-mini10.c)
系统调用 /kernel/sys.c
内核驱动调试
添加 tps6507x_regulator.c
/device drivers/voltage and current regulator support/ti tps6507x power regulators
读写寄存器
static inline void stop_timer_for_1wire(void) { }
static inline void set_pin_value(int v) {
unsigned long tmp;
tmp = readl(S3CXX_GPFDAT); if (v) {
tmp |= (1 << 15); tmp &= ~(1<<15); } else {
unsigned long tcon;
tcon &= ~S3C2410_TCON_T3START; writel(tcon, S3C2410_TCON);
tcon = __raw_readl(S3C2410_TCON);
}
}
writel(tmp, S3CXX_GPFDAT);
static inline int get_pin_value(void) { }
int v;
unsigned long tmp;
tmp = readl(S3CXX_GPFDAT); v = !!(tmp & (1<<15)); return v;
因篇幅问题不能全部显示,请点此查看更多更全内容