[Replicant] replicant init.target.rc modifications
Wolfgang Wiedmeyer
wreg at wiedmeyer.de
Sat Mar 4 21:01:05 UTC 2017
Simon Josefsson writes:
> Hi all.
>
> I noticed that the i9300 /init.target.rc of Replicant 6 deviates from
> upstream wrt gps:
>
> https://github.com/LineageOS/android_device_samsung_i9300/blob/cm-13.0/rootdir/init.target.rc#L105
> https://git.replicant.us/replicant/device_samsung_i9300/blob/replicant-6.0/rootdir/init.target.rc#L96
>
> The commit that introduced this difference said the reason was to reduce
> 'dmesg' spam:
>
> https://git.replicant.us/replicant/device_samsung_i9300/commit/eb564f1803a0145eef68b59cdbb75362175d05a7
>
> I have come up with another way to solve the 'dmesg' spam problem,
> without having to deviate from upstream init.target.rc. How about the
> attached patch? I have tested it on my phone, both with and without any
> /system/bin/glgps binary, and there is no dmesg spam.
>
> Thanks,
> /Simon
>
> From b421692b7da72424decc7ddc0db46956d182dc06 Mon Sep 17 00:00:00 2001
> From: Simon Josefsson <simon at josefsson.org>
> Date: Sat, 4 Mar 2017 17:34:22 +0000
> Subject: [PATCH] Reduce divergance from LineageOS init.target.rc -- resolve
> dmesg spam in another way.
>
> ---
> gps_daemon.sh | 1 +
> rootdir/init.target.rc | 14 +++++++-------
> 2 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/gps_daemon.sh b/gps_daemon.sh
> index 7cd6b64..6204974 100644
> --- a/gps_daemon.sh
> +++ b/gps_daemon.sh
> @@ -1,2 +1,3 @@
> #shellscript as this is the only way selinux will allow this to proceed
> /system/bin/glgps -c /system/etc/gps.xml
> +sleep 12345678
We already talked about this on irc. This would make the script run for
this amount of time and it would do nothing. This is only to prevent
that the script is immediately run again by init. An alternative would
be to define a property like ro.use.proprietary.gps and only run the script
if the property is set in build.prop.
There may be a solution that doesn't require any change. It's possible
to place a script named userinit.sh in /data/local/ and this script
should be started by sysinit[1][2][3]. Sysinit is started in
init.cm.rc. So it may be enough to move /system/bin/gps_daemon.sh to
/data/local/userinit.sh. I didn't test this, but it would be interesting
in general if it's possible to write a custom init script and run it
this way without a need to modify the ramdisk. It looks like this was
originally intended for being able to run a ssh server.
> diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc
> index 4fcf34d..1652d6d 100644
> --- a/rootdir/init.target.rc
> +++ b/rootdir/init.target.rc
> @@ -93,11 +93,11 @@ on fs
> # zram
> swapon_all /fstab.smdk4x12
>
> -#on boot
> +on boot
> # Start GPS daemon
> -#service gps-daemon /system/bin/sh /system/bin/gps_daemon.sh
> -# class main
> -# socket gps seqpacket 0660 gps system
> -# user gps
> -# group system inet sdcard_rw gps
> -# seclabel u:r:glgps:s0
> +service gps-daemon /system/bin/sh /system/bin/gps_daemon.sh
> + class main
> + socket gps seqpacket 0660 gps system
> + user gps
> + group system inet sdcard_rw gps
> + seclabel u:r:glgps:s0
It seems that the userinit.sh script is only started once (sysinit has
"oneshot"). So the a similar behaviour could also be achieved by adding
"oneshot" here to the gps-daemon options. This would likely solve the
problem that init keeps rerunning the script. A disadvantage could be
that the device needs to be restarted in the case that the gps daemon
exits or crashes.
I suggest trying the options I listed before applying the patch with the
sleep command.
Best regards,
Wolfgang
[1] https://git.replicant.us/replicant/vendor_replicant/blob/replicant-6.0/prebuilt/common/etc/init.d/90userinit
[2] https://git.replicant.us/replicant/vendor_replicant/blob/replicant-6.0/prebuilt/common/bin/sysinit
[3] https://git.replicant.us/replicant/vendor_replicant/blob/replicant-6.0/prebuilt/common/etc/init.local.rc#L153
--
Website: https://fossencdi.org
OpenPGP: 0F30 D1A0 2F73 F70A 6FEE 048E 5816 A24C 1075 7FC4
Key download: https://wiedmeyer.de/keys/ww.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/replicant/attachments/20170304/54a6c32c/attachment.asc>
More information about the Replicant
mailing list