Skip to content

Commit

Permalink
init: Do not build logo.c when initlogo is disabled
Browse files Browse the repository at this point in the history
For now, logo.c was build even if TARGET_NO_INITLOGO was true.
Changing tty to KD_GRAPHICS is now done in init.c as it should be, when
the logo is not present.

Change-Id: Ifabd9aebc9c0ad8d6903e963dfac031a6dac32e1
  • Loading branch information
m-chojnacki authored and Gerrit Code Review committed Oct 1, 2013
1 parent dfe600e commit 0e11087
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
6 changes: 3 additions & 3 deletions init/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ LOCAL_SRC_FILES:= \
property_service.c \
util.c \
parser.c \
logo.c \
keychords.c \
signal_handler.c \
init_parser.c \
Expand All @@ -27,8 +26,9 @@ ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
LOCAL_CFLAGS += -DALLOW_LOCAL_PROP_OVERRIDE=1
endif

ifeq ($(TARGET_NO_INITLOGO),true)
LOCAL_CFLAGS += -DNO_INITLOGO
ifneq ($(TARGET_NO_INITLOGO),true)
LOCAL_SRC_FILES += logo.c
LOCAL_CFLAGS += -DINITLOGO
endif

ifneq ($(TARGET_NR_SVC_SUPP_GIDS),)
Expand Down
12 changes: 12 additions & 0 deletions init/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@

#include <sys/system_properties.h>

#ifndef INITLOGO
#include <linux/kd.h>
#endif

#include "devices.h"
#include "init.h"
#include "log.h"
Expand Down Expand Up @@ -650,6 +654,7 @@ static int console_init_action(int nargs, char **args)
have_console = 1;
close(fd);

#ifdef INITLOGO
if( load_565rle_image(INIT_IMAGE_FILE) ) {
fd = open("/dev/tty0", O_WRONLY);
if (fd >= 0) {
Expand All @@ -673,6 +678,13 @@ static int console_init_action(int nargs, char **args)
close(fd);
}
}
#else
fd = open("/dev/tty0", O_RDWR | O_SYNC);
if (fd >= 0) {
ioctl(fd, KDSETMODE, KD_GRAPHICS);
close(fd);
}
#endif
return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions init/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,11 @@ void service_reset(struct service *svc);
void service_start(struct service *svc, const char *dynamic_args);
void property_changed(const char *name, const char *value);

#ifdef INITLOGO
#define INIT_IMAGE_FILE "/initlogo.rle"

int load_565rle_image( char *file_name );
#endif

extern struct selabel_handle *sehandle;
extern struct selabel_handle *sehandle_prop;
Expand Down
2 changes: 0 additions & 2 deletions init/logo.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ int load_565rle_image(char *fn)
if (vt_set_mode(1))
return -1;

#ifndef NO_INITLOGO
fd = open(fn, O_RDONLY);
if (fd < 0) {
ERROR("cannot open '%s'\n", fn);
Expand Down Expand Up @@ -151,7 +150,6 @@ int load_565rle_image(char *fn)
fb_close(&fb);
close(fd);
unlink(fn);
#endif
return 0;

fail_unmap_data:
Expand Down

0 comments on commit 0e11087

Please sign in to comment.