Galaxy Xcover 4 boot on charge (solved)

7 posts
Thanks Meter: 0
By palebluedot, Junior Member on 1st August 2018, 10:40 AM
Post Reply Email Thread
I am trying to make the Galaxy Xcover 4 boot automatically when power is connected. The model number is SM-G390F. I have rooted the device through ODIN/CF Auto Root found on androidmtk (apparently I cannot post links yet due to being a new user).

My first thought was to use fastboot ("fastboot oem off-mode-charge 0"), but since the phone doesn't have fastboot that option is out of the question. I have searched the forums, and found some threads mentioning that I should modify the /system/bin/lpm file. Specifically, the suggestions I found were to replace the contents of the /system/bin/lpm file with

I tried the above, but to no avail. After changing the /system/bin/lpm file with the above contents, making sure that the file uses Unix EOL characters (no carriage returns, only line feeds), and giving it the correct permissions, the phone just displays an empty battery icon (as opposed to a battery charging animation) upon inserting the power cord, and doesn't boot. It also makes it so that the physical power button stops working; I now have to boot via volume-/home/power. Does anyone have any suggestions or solutions?

6th August 2018, 11:42 AM |#2  
OP Junior Member
Flag Bergen
Thanks Meter: 0
In the end I managed to accomplish what I wanted to, but I had to do it in a very fiddly way. Posting it here for future reference for anyone else who might have similar troubles.

The TLDR: I had to edit some init.*.rc files found on the ramdisk. The problem with editing these files directly is that as the name implies, any changes made to the ramdisk during runtime aren't persisted. So what I had to do was to extract the boot partition of the device as an ".img" file onto my development computer, modify a few init.*.rc files, repack the changes as a .img file, and flash it back onto the phone.

Extracting the boot partition
To extract the boot partition, I first found where it is:
> ls -l /dev/block/platform/13540000.dwmmc0/by-name
lrwxrwxrwx 1 root root 21 2018-08-06 11:00 BOOT -> /dev/block/mmcblk0p10
lrwxrwxrwx 1 root root 20 2018-08-06 11:00 BOTA0 -> /dev/block/mmcblk0p1
lrwxrwxrwx 1 root root 20 2018-08-06 11:00 BOTA1 -> /dev/block/mmcblk0p2
lrwxrwxrwx 1 root root 21 2018-08-06 11:00 CACHE -> /dev/block/mmcblk0p21
lrwxrwxrwx 1 root root 20 2018-08-06 11:00 CARRIER -> /dev/block/mmcblk0p8
lrwxrwxrwx 1 root root 21 2018-08-06 11:00 CDMA-RADIO -> /dev/block/mmcblk0p13
As we see, the boot partition lies in /dev/block/mmcblk0p10. So the next step was to

cat  /dev/block/mmcblk0p10 > /sdcard/boot.img
which resulted in a boot.img in the /sdcard/ directory, which I then copied onto my development PC.

Unpacking boot.img
To unpack boot.img, I used a program called Android Image Kitchen. I still cannot post links, so just search for it. After unpacking boot.img, I got a folder called "ramdisk" which contained, among other things, a bunch of init.*.rc files.

Editing the init.*.rc files
I had to make changes to two files, init.rc and init.samsungexynos7570.rc.

For init.rc, I made the following changes:
  • Removed the lpm service. Example:
    #service lpm /system/bin/lpm
    #    class charger
    #    critical
  • Removed the "on charger" trigger.
  • Added the following trigger:
    on property:ro.bootmode=charger
        trigger late-init

and for init.samsungexynos7570.rc I made these changes:
  • Removed the lpm service.
  • Removed the "on property:ro bootmode=charger" triggers.

Repacking the edited ramdisk
To repack the edited ramdisk I once again used Android Image Kitchen.

Flashing the modified ramdisk
To flash the modified ramdisk I used ODIN version 3.12.5. In order for it to be flashable through ODIN the .img file needs to be turned into a .tar file. I used 7zip for this. It is also very important that .img file is called "boot.img" before being tar-ed. Not sure if the .tar file has such stringent naming requirements as well.

The phone now boots automatically when connecting power (if powered off). Caveat: The touch screen does not work when booting via connecting power, but for my own specific scenario this is not a problem as I am going to use the phone as a kiosk device without touch functionality. To enable the touch screen I suspect I just need to preserve some of the stuff in the init.samsungexynos7570.rc file that I initially removed.
28th August 2019, 08:55 PM |#3  
Senior Member
Thanks Meter: 6
Does the device also turn on when you try to power it off if it is still plugged in?
Post Reply Subscribe to Thread


Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes