|
|

楼主 |
发表于 2006-7-27 00:16:28
|
显示全部楼层
+void splash_init(void)
+{
+ struct fb_info *info;
+ struct vc_data *vc;
+ int isramfs = 1;
+ int fd;
+ int len;
+ int max_len = 1024*1024*2;
+ char *mem;
+
+ if (splash_registered)
+ return;
+ vc = vc_cons[0].d;
+ info = registered_fb[0];
+ if (!vc || !info || info->var.bits_per_pixel != 16)
+ return;
+#ifdef CONFIG_PROC_FS
+ splash_proc_register();
+#endif
+ splash_registered = 1;
+ if (vc->vc_splash_data)
+ return;//这句就是对2.6内核的bootsplash补丁里,尝试读取ramdisk里的bootsplas
+ if ((fd = sys_open("/bootsplash", O_RDONLY, 0)) < 0) {
+ isramfs = 0;
+ fd = sys_open("/initrd.image", O_RDONLY, 0);
+ }
+ if (fd < 0)
+ return;
+ if ((len = (int)sys_lseek(fd, (off_t)0, 2)) <= 0) {
+ sys_close(fd);
+ return;
+ }
+ /* Don't look for more than the last 2MB */
+ if (len > max_len) {
+ printk( KERN_INFO "bootsplash: scanning last %dMB of initrd for signature\n",
+ max_len>>20);
+ sys_lseek(fd, (off_t)(len - max_len), 0);
+ len = max_len;
+ } else {
+ sys_lseek(fd, (off_t)0, 0);
+ }
+
+ mem = vmalloc(len);
+ if (mem) {
+ acquire_console_sem();
+ if ((int)sys_read(fd, mem, len) == len && splash_getraw((unsigned char *)mem, (unsigned char *)mem + len, (int *)0) == 0 && vc->vc_splash_data)
+ vc->vc_splash_data->splash_state = splash_default & 1;
+ release_console_sem();
+ vfree(mem);
+ }
+ sys_close(fd);
+ if (isramfs)
+ sys_unlink("/bootsplash");
+ return;
+}
+ |
|