Off-Topic Discussion for kitchen users

Search This thread

FREETESTER

Member
Feb 16, 2009
11
0
Thanks again pal, i thought it were be easier to fulfill my needs, but i see i have more work on front, nevertheless any kind of help will be appreciated...
 

bcrichster

Senior Member
Jun 6, 2013
1,218
833
It seems the guides I had used were from the GB-ICS days and have been buried somewhere in XDA.. here's a close one that's similar but not rrally detailed enough for current needs. Just remember that whatever image files you replace, need be same pixel sizes and image name as the original to prevent glaring errors or compiling issues.

https://forum.xda-developers.com/showthread.php?t=2058850

There was also an old app.. called Meta-Ninja or something that gave way better details but I'm unable to find it again.

Sent from my moto x4 using Tapatalk
 
  • Like
Reactions: SuperR.

eladkarako

Senior Member
Jul 12, 2012
95
32
Westminster
eladkarako.com
Goodbye boot.img editing on Samsung/PIE

FYI
Samsung users with S10+ (and some that installed Android PIE for other devices too) no-longer can use Kitchen to edit the boot image, since Samsung no-longer includes a ramdisk in it, and the bootloader no-longer boots anything but the core kernel binary.
This means that most of the root methods and prop editing won't work anymore.
Magisk (for example) patches the recovery image, and makes Samsung users "short-boot" into recovery each time to have root,
if you miss one time, and loads the system as normal it will refuse to boot again (the fault is a new 'vault' mechanism) and you'll have to flash the original firmware and you won't be able to flash anything else for about 7-days,
during that time the OEM-unlocking, a.k.a bootloader option won't even be shown in the developer-menu (even if already unlocked), but it will be shown again after a week of using the phone.

Possible solution is to flash TWRP instead of stock recovery and then flash a few zips (disable dm-Verity and ForceEncrypt, RMM Bypass). It's almost impossible, the order of things matter (naturally...), and there are very few guides that explain how to do it properly, and it also depends if your device has a stable TWRP version (mine doesn't... :| )

Sources:
1. Magisk installation page: https://forum.xda-developers.com/galaxy-s10/development/magisk-root-galaxy-s10-series-t3918699
2. Personal experience in flashing S10+ (PIE) and J400F (PIE)

Magisk can't handle the vault mechanisms on my devices for now,
I hope there will be a more stable version in the future, will check again maybe in 6 months...
 
Last edited:

Miustone

Senior Member
Jul 23, 2012
2,947
5,732
27
Marburg an der Lahn
sites.google.com
Hey Folks! I have a question/request... Would it be possible to run the Kitchen on a Chromebook that supports natively Linux Apps? It would be super fantastic to use a Google OS to edit a Google OS in My Eyes, but i wanted to ask first about the possibilty in Theory...

BR
 

Verbato

Senior Member
Jan 1, 2007
366
180
Hallingdal
If you have trouble with authentication, you can always message me privately.
Thank you
I have a silly question as well. So this should be interesting.
How do I set immutable on a file in... I guess it is fs_config? I have a file in system/system/...somewhere, that I need to make sure remains untouched. 0644 does not do the job. chmod 0644 followed by chattr +i does the job. How do I do this in... file_contexts3-system or fs_config-system?
 

SuperR.

Recognized Developer
Mar 23, 2014
2,595
8,576
Invisible
Moto E 2015
LG Nexus 5X
Not a silly question. I believe I have the answer, but I am not completely sure.

In the case of setting a file as immutable, I believe this is a file capability called CAP_LINUX_IMMUTABLE. According to capabilities.h, it has a value of 9.

Thanks to this post by @Captain_Throwback, we can turn that "9" into a value recognized by fs_config-system.

Code:
2^9=512

Now that we have the correct value (512), we can add it to the file in fs_config-system

Code:
system/file/to/change 0 0 0644 capabilities=512

Save the file and build system.img.

Reminder, I am not absolutely sure this will do what you want, but I think it will. Good luck :)

EDIT: Now I think I am completely wrong lol. The above should give a file permissions to modify immutable files. I have no idea how to set immutable files in e2fsdroid. I did some testing, set a file immutable, looked at the file permissions, and they did not change.
 
Last edited:
  • Like
Reactions: Verbato

Verbato

Senior Member
Jan 1, 2007
366
180
Hallingdal
EDIT: Now I think I am completely wrong lol. The above should give a file permissions to modify immutable files. I have no idea how to set immutable files in e2fsdroid. I did some testing, set a file immutable, looked at the file permissions, and they did not change.
Yeah, I've been down that path of trying to solve, so close to finding the solution, and then... nope.
I'll just have to do it manually then.
Thank you for going down the path of trying to find a solution for me! Much appreciated! 👍

Edit: In your link, he converted the 512 (or, in his case, 1024) number to hex before adding it after capabilities=.
512 is 200 in hex. Maybe that is the detail that makes it work?
capabilities=200? Instead of 512.
 
Last edited:

SuperR.

Recognized Developer
Mar 23, 2014
2,595
8,576
Invisible
Moto E 2015
LG Nexus 5X
Yeah, I've been down that path of trying to solve, so close to finding the solution, and then... nope.
I'll just have to do it manually then.
Thank you for going down the path of trying to find a solution for me! Much appreciated! 👍

Edit: In your link, he converted the 512 (or, in his case, 1024) number to hex before adding it after capabilities=.
512 is 200 in hex. Maybe that is the detail that makes it work?
capabilities=200? Instead of 512.
512 is correct in this case. The hex value is what set_metadata lines in the updater-script need. Note the post date in the link, Jan 12, 2017. This was back when set_metadata ROMs were still a good option :) For fs_config entries, we want the decimal value. Just to reiterate, I don't think setting this capability is what you are looking for.

EDIT: I don't think chattr +i changes the file at all. I think it sets a flag in the file system somewhere. See this example:

Code:
$ sha256sum tester
6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b  tester
$ sudo chattr +i tester
$ rm -f tester
rm: cannot remove 'tester': Operation not permitted
$ sudo rm -f tester
rm: cannot remove 'tester': Operation not permitted
$ sha256sum tester
6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b  tester

As you can see here, the file was not modified at all after chattr +i, but the file is absolutely immutable.

One option for you is to include chattr binary in your ROM, and run a script after the system.img is flashed to make the files immutable. You could use the configure.sh script in the updater-script as a template on how to run the script. If chattr is included in your firmware, you don't need to include the binary.
 
Last edited:

Verbato

Senior Member
Jan 1, 2007
366
180
Hallingdal
One option for you is to include chattr binary in your ROM, and run a script after the system.img is flashed to make the files immutable. You could use the configure.sh script in the updater-script as a template on how to run the script. If chattr is included in your firmware, you don't need to include the binary.
Yeah, this is precisely what I was looking for. Making it chattr +i means it can't be deleted. Again, thank you!
Edit: Oh, when I wrote "remains untouched", I meant something else than "not touch /somewhere/file". I was thinking, "not deleted", but wrote "remains untouched". Well, because chattri +i means it can't be changed from 644. If it's not chattr +i then it can be deleted, even if it is read only.
 
Last edited:

SuperR.

Recognized Developer
Mar 23, 2014
2,595
8,576
Invisible
Moto E 2015
LG Nexus 5X
Yeah, this is precisely what I was looking for. Making it chattr +i means it can't be deleted. Again, thank you!
Edit: Oh, when I wrote "remains untouched", I meant something else than "not touch /somewhere/file". I was thinking, "not deleted", but wrote "remains untouched". Well, because chattri +i means it can't be changed from 644. If it's not chattr +i then it can be deleted, even if it is read only.
Moved this conversation because it is off topic from the kitchen.

If your system partition is read-only, I do not think you will be able to use chattr +i on a file in the system partition. Unfortunately I have exhausted my knowledge on this topic, but I hope you get it figured out :)
 

Verbato

Senior Member
Jan 1, 2007
366
180
Hallingdal
Moved this conversation because it is off topic from the kitchen.

If your system partition is read-only, I do not think you will be able to use chattr +i on a file in the system partition. Unfortunately I have exhausted my knowledge on this topic, but I hope you get it figured out :)
If my system partition was read only I would never have had to ask for an immutable flag.
I'm sorry to say, it isn't. :cry:
 

Verbato

Senior Member
Jan 1, 2007
366
180
Hallingdal
You could try adding the shared blocks feature to your system.img. This will make it read-only. See the note in this post which explains how to do it.
Yeah... That would make the whole filesystem read only. I just need one file to be so. It's a crude solution. I've used crude solutions many times, just to get things to work.
I'll just adb shell chattr +i the file though.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Not a silly question. I believe I have the answer, but I am not completely sure.

    In the case of setting a file as immutable, I believe this is a file capability called CAP_LINUX_IMMUTABLE. According to capabilities.h, it has a value of 9.

    Thanks to this post by @Captain_Throwback, we can turn that "9" into a value recognized by fs_config-system.

    Code:
    2^9=512

    Now that we have the correct value (512), we can add it to the file in fs_config-system

    Code:
    system/file/to/change 0 0 0644 capabilities=512

    Save the file and build system.img.

    Reminder, I am not absolutely sure this will do what you want, but I think it will. Good luck :)

    EDIT: Now I think I am completely wrong lol. The above should give a file permissions to modify immutable files. I have no idea how to set immutable files in e2fsdroid. I did some testing, set a file immutable, looked at the file permissions, and they did not change.
  • 6
    This thread should serve as a much needed place for kitchen users to discuss anything not exactly kitchen related :)
    3
    @Kaiyum @cmdmoto @jazzespresso

    Moved this conversation over here. Talk as much as you like :)
    2
    @Mr Hassan, @The Exploiter
    Moved your posts into this thread as they are off topic for the kitchen. Feel free to continue here if you would like :)
    2
    @shoey63 and @kevintm78 I run Linux, why does everyone assume we are all running Windows LOL... ;)

    Anyhow I like to do things by hand, I thought the Kitchen Master would have some tricks up his sleeve.

    Looks like @bcrichster gets the prize! Signing it seems to of done the trick, the signed apk boots... :)

    So after a bit of Googling I came up with this;

    I ran the cmds in /etc/ssl/localcerts

    openssl genrsa -out key.pem 1024
    openssl req -new -key key.pem -out request.pem
    openssl x509 -req -days 9999 -in request.pem -signkey key.pem -out certificate.pem
    openssl pkcs8 -topk8 -outform DER -in key.pem -inform PEM -out key.pk8 -nocrypt

    For now I'm using/testing this signapk.jar; https://github.com/appium/sign not sure if it matters to use this signapk.jar or I really need it from Google?

    I also found this uber-apk-signer;

    https://github.com/patrickfav/uber-apk-signer

    I also found the Google version;

    https://android.googlesource.com/platform/prebuilts/sdk/+/master/tools/lib?autodive=0//

    You can download the entire /lib directory on the tgz link which has the Google signapk.jar in it. All I know is there's a lot going on between appium's version and Google, not really sure I need the Google one? hmm

    I tried to sign with the Google version it doesn't work it wants other libraries I don't have; (so much for this version)

    Caused by: java.lang.IllegalArgumentException: Failed to load any of the given libraries: [conscrypt_openjdk_jni-linux-x86_64, conscrypt_openjdk_jni-linux-x86_64-fedora, conscrypt_openjdk_jni]

    Then I signed the apk with the appium version;

    java -jar signapk.jar /etc/ssl/localcerts/certificate.pem /etc/ssl/localcerts/key.pk8 framework-res.apk test.apk


    By the way if anyone knows, when I compile the apk, I get back at the terminal, "could not find sources" and a lot of output about "has no default translation"

    I read that a framework-res.apk is itself the source of other apks and the message "could not find sources" is normal... hmm


    ./apktool b -c framework-res
    I: Using Apktool 2.3.4
    W: Could not find sources
    I: Checking whether resources has changed...
    I: Building resources...
    W: warning: string 'BIND_OEMEX_SERVICE' has no default translation.
    W: warning: string 'adb_active_generic_notification_message' has no default translation.
    W: warning: string 'adb_both_active_notification_title' has no default translation.
    I: Copy original files...
    I: Copy AndroidManifest.xml...
    I: Copy META-INF...
    I: Building apk file...
    I: Copying unknown files/dir...
    I: Built apk...

    Thanks

    P.S. @SuperR. sorry for Off Topic... :(
    2
    Hey @SuperR. I have a general apktool question.

    I want to make some SystemUI mods for my ROM.

    When recompiling SystemUI does it need to be signed, zipaligned, or both?

    Your tool is awesome btw.

    For system apps, I use winrar, or if using linux the default archive manager, to move the modified files into the original. I try to keep the meta-inf, sec-inf, and androidmanifest.xml intact on the original app and just drag the res, classes.dex (if modifying smali), and resources.arsc into the original. Then just zipalign.

    Thats worked for me on 6.0.1, I think some things may have changed with 7.0.1 and I'm by no means an expert but thats how I do it.
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone