我正在调查android第一次启动,并希望启用引导图,但我总是失败,下面是我所做的,有人可以帮助我吗?
因为引导图服务比/data分区挂载更早启动,所以每次引导图失败。内核日志中的失败消息是:引导init失败
因此,为了确保引导图的成功,我更改了相关代码。该解决方案在Android中可以很好地工作,但在Android MR1中却失败了。手机继续重新启动后,实现以下更改;在我禁用selinux后,手机块在第一个标志。
init/bootchart.c
/* called to setup bootcharting */
int bootchart_init( void )
{
int ret;
char buff[4];
int timeout = 0, count = 0;
buff[0] = 0;
+ /* wait until /data mounted */
+ struct stat datadir;
+ if(stat("/data/bootchart-start", &datadir) == -1) {
+ ERROR("Bootchart, /data/bootchart-start not exists\n");
+ return -1;
+ }
proc_read( LOG_STARTFILE, buff, sizeof(buff) );
if (buff[0] != 0) {
timeout = atoi(buff);
}init/init.c
static int bootchart_init_action(int nargs, char **args)
{
bootchart_count = bootchart_init();
if (bootchart_count < 0) {
ERROR("bootcharting init failure\n");
+ queue_builtin_action(bootchart_init_action, "bootchart_init");
} else if (bootchart_count > 0) {
NOTICE("bootcharting started (period=%d ms)\n", bootchart_count*BOOTCHART_POLLING_MS);
} else {
NOTICE("bootcharting ignored\n");
}rootdir/init.rc
on post-fs-data
# We chown/chmod /data again so because mount is run as root + defaults
chown system system /data
chmod 0771 /data
# We restorecon /data in case the userdata partition has been reset.
restorecon /data
+ write /data/bootchart-start 600
# Avoid predictable entropy pool. Carry over entropy from previous boot.
copy /data/system/entropy.dat /dev/urandom/system/core/init/Android.mk
+ INIT_BOOTCHART :=true
ifeq ($(strip $(INIT_BOOTCHART)),true)
LOCAL_SRC_FILES += bootchart.c
LOCAL_CFLAGS += -DBOOTCHART=1
endif有没有人在android MR1上启用引导图?你怎么能改变代码呢?如何修改代码以确保引导图在/data/分区挂载后运行?
提前谢谢你!这对我来说很严重。
发布于 2020-02-11 10:23:55
我能够通过这个init.rc为第一次引导启用引导图。
on post-fs-data
# We chown/chmod /data again so because mount is run as root + defaults
chown system system /data
chmod 0771 /data
# We restorecon /data in case the userdata partition has been reset.
restorecon /data
# start debuggerd to make debugging early-boot crashes easier.
start debuggerd
start debuggerd64
# Make sure we have the device encryption key.
start vold
installkey /data
# Start bootcharting as soon as possible after the data partition is
# mounted to collect more data.
mkdir /data/bootchart 0755 shell shell
# if you need to enable bootchart uncomment next line
# Old Android
# write /data/bootchart-start 120
# Android > 7.0
# write /data/bootchart/start 120
bootchart_inithttps://stackoverflow.com/questions/34347192
复制相似问题