* commit '308f0f9bf2a82d9c1e02982f0e177f6b04545210': init: remove obsolete rle logo
This commit is contained in:
commit
8ac7c9f659
4 changed files with 21 additions and 190 deletions
|
@ -10,7 +10,6 @@ LOCAL_SRC_FILES:= \
|
|||
property_service.c \
|
||||
util.c \
|
||||
parser.c \
|
||||
logo.c \
|
||||
keychords.c \
|
||||
signal_handler.c \
|
||||
init_parser.c \
|
||||
|
|
43
init/init.c
43
init/init.c
|
@ -654,29 +654,28 @@ static int console_init_action(int nargs, char **args)
|
|||
have_console = 1;
|
||||
close(fd);
|
||||
|
||||
if( load_565rle_image(INIT_IMAGE_FILE) ) {
|
||||
fd = open("/dev/tty0", O_WRONLY);
|
||||
if (fd >= 0) {
|
||||
const char *msg;
|
||||
msg = "\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n" // console is 40 cols x 30 lines
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
" A N D R O I D ";
|
||||
write(fd, msg, strlen(msg));
|
||||
close(fd);
|
||||
}
|
||||
fd = open("/dev/tty0", O_WRONLY);
|
||||
if (fd >= 0) {
|
||||
const char *msg;
|
||||
msg = "\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n" // console is 40 cols x 30 lines
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
" A N D R O I D ";
|
||||
write(fd, msg, strlen(msg));
|
||||
close(fd);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,10 +133,6 @@ void service_restart(struct service *svc);
|
|||
void service_start(struct service *svc, const char *dynamic_args);
|
||||
void property_changed(const char *name, const char *value);
|
||||
|
||||
#define INIT_IMAGE_FILE "/initlogo.rle"
|
||||
|
||||
int load_565rle_image( char *file_name );
|
||||
|
||||
extern struct selabel_handle *sehandle;
|
||||
extern struct selabel_handle *sehandle_prop;
|
||||
extern int selinux_reload_policy(void);
|
||||
|
|
163
init/logo.c
163
init/logo.c
|
@ -1,163 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2008 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <linux/fb.h>
|
||||
#include <linux/kd.h>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include <cutils/memory.h>
|
||||
#else
|
||||
void android_memset16(void *_ptr, unsigned short val, unsigned count)
|
||||
{
|
||||
unsigned short *ptr = _ptr;
|
||||
count >>= 1;
|
||||
while(count--)
|
||||
*ptr++ = val;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct FB {
|
||||
unsigned short *bits;
|
||||
unsigned size;
|
||||
int fd;
|
||||
struct fb_fix_screeninfo fi;
|
||||
struct fb_var_screeninfo vi;
|
||||
};
|
||||
|
||||
#define fb_width(fb) ((fb)->vi.xres)
|
||||
#define fb_height(fb) ((fb)->vi.yres)
|
||||
#define fb_size(fb) ((fb)->vi.xres * (fb)->vi.yres * 2)
|
||||
|
||||
static int fb_open(struct FB *fb)
|
||||
{
|
||||
fb->fd = open("/dev/graphics/fb0", O_RDWR);
|
||||
if (fb->fd < 0)
|
||||
return -1;
|
||||
|
||||
if (ioctl(fb->fd, FBIOGET_FSCREENINFO, &fb->fi) < 0)
|
||||
goto fail;
|
||||
if (ioctl(fb->fd, FBIOGET_VSCREENINFO, &fb->vi) < 0)
|
||||
goto fail;
|
||||
|
||||
fb->bits = mmap(0, fb_size(fb), PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED, fb->fd, 0);
|
||||
if (fb->bits == MAP_FAILED)
|
||||
goto fail;
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
close(fb->fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void fb_close(struct FB *fb)
|
||||
{
|
||||
munmap(fb->bits, fb_size(fb));
|
||||
close(fb->fd);
|
||||
}
|
||||
|
||||
/* there's got to be a more portable way to do this ... */
|
||||
static void fb_update(struct FB *fb)
|
||||
{
|
||||
fb->vi.yoffset = 1;
|
||||
ioctl(fb->fd, FBIOPUT_VSCREENINFO, &fb->vi);
|
||||
fb->vi.yoffset = 0;
|
||||
ioctl(fb->fd, FBIOPUT_VSCREENINFO, &fb->vi);
|
||||
}
|
||||
|
||||
static int vt_set_mode(int graphics)
|
||||
{
|
||||
int fd, r;
|
||||
fd = open("/dev/tty0", O_RDWR | O_SYNC);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
r = ioctl(fd, KDSETMODE, (void*) (graphics ? KD_GRAPHICS : KD_TEXT));
|
||||
close(fd);
|
||||
return r;
|
||||
}
|
||||
|
||||
/* 565RLE image format: [count(2 bytes), rle(2 bytes)] */
|
||||
|
||||
int load_565rle_image(char *fn)
|
||||
{
|
||||
struct FB fb;
|
||||
struct stat s;
|
||||
unsigned short *data, *bits, *ptr;
|
||||
unsigned count, max;
|
||||
int fd;
|
||||
|
||||
if (vt_set_mode(1))
|
||||
return -1;
|
||||
|
||||
fd = open(fn, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
ERROR("cannot open '%s'\n", fn);
|
||||
goto fail_restore_text;
|
||||
}
|
||||
|
||||
if (fstat(fd, &s) < 0) {
|
||||
goto fail_close_file;
|
||||
}
|
||||
|
||||
data = mmap(0, s.st_size, PROT_READ, MAP_SHARED, fd, 0);
|
||||
if (data == MAP_FAILED)
|
||||
goto fail_close_file;
|
||||
|
||||
if (fb_open(&fb))
|
||||
goto fail_unmap_data;
|
||||
|
||||
max = fb_width(&fb) * fb_height(&fb);
|
||||
ptr = data;
|
||||
count = s.st_size;
|
||||
bits = fb.bits;
|
||||
while (count > 3) {
|
||||
unsigned n = ptr[0];
|
||||
if (n > max)
|
||||
break;
|
||||
android_memset16(bits, ptr[1], n << 1);
|
||||
bits += n;
|
||||
max -= n;
|
||||
ptr += 2;
|
||||
count -= 4;
|
||||
}
|
||||
|
||||
munmap(data, s.st_size);
|
||||
fb_update(&fb);
|
||||
fb_close(&fb);
|
||||
close(fd);
|
||||
unlink(fn);
|
||||
return 0;
|
||||
|
||||
fail_unmap_data:
|
||||
munmap(data, s.st_size);
|
||||
fail_close_file:
|
||||
close(fd);
|
||||
fail_restore_text:
|
||||
vt_set_mode(0);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in a new issue