How to customize, and in some part produce a rom from another rom (ideally a stock one), without data corruption and incorrect metadata, corrupt other.
Note: OSFMount + Ext2fsd, and also FreeBSD (Unix) do not interface with non-standard data for android partitions (ext4, lightly modded).
Interestingly both OSFMount + Ext2fsd and FreeBSD fail at the same general issue, metadata and file attributes (ext is not native).
With FreeBSD, chattr and lsattr do not function, they run, but read and write nothing, 'noatime' is not applied to files.
Note: FreeBSD will allow you to change permissions on symlinks (chmod -h), whereas linux does not.
First, it's likely the 'system.img' file is a sparse one, and cannot be mounted, so you will need to convert it to a raw 'system.img'.
simg2img Path-to-in\system.img Path-to-out\system.img
Now you will need to setup a debian distro on VirtualBox, I suggest 'Lubuntu
', it's lighter and faster, and fully compatible., here is a quick after install guide:
Install guest additions via the iso, and terminal as 'root' (sudo), simply type 'sudo' and drag and drop the linux setup file into the console.
Setup shares for the current user || sudo usermod -aG vboxsf YOURUSERNAME
Full install guide: https://linuxhint.com/install_ubuntu_18-04_virtualbox/
Once you have setup shared folders (in my case 'D:\Files' as '/home/ferather/Files') copy the 'system.img' to '/'.
You can now mount it, and modify almost everything without metadata corruption.
sudo mkdir /system & sudo mount /system.img /system & sudo pcmanfm-qt /system
sudo mkdir /system & sudo losetup -fP /system.img & sudo mount -o noatime /dev/loop1 /system & sudo pcmanfm-qt /system
sudo mkdir /system & sudo mdconfig -a -t vnode -f /system.img -u 1 & sudo mount -t ext2fs -o noatime /dev/md1 /system & sudo pcmanfm /system
Note: 'pcmanfm-qt' and 'pcmanfm' are file managers, with root icons and theme.
How to boot:
You will need to unpack your 'boot.img', see post 3 for more details. Once unpacked you will need to modify the 'fstab.xxxx', where xxx varies with device.
I am using 'Programmers notepad
' to modify linux files under windows, it's fully compatible with LF and CR line endings.
Now open your 'fstab.xxx' file, and find /system, and remove the verify part, example:
Old || /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system /system ext4 ro wait,verify=/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/metadata
New || /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system /system ext4 ro wait
Now you will need to repack your modified boot back into 'boot.img', for good measure you should unpack and do the same to the 'recovery.img'.
Note: If you wish to add tweaks to a '.prop' file, but want to maintain stock and verify, add them to 'default.prop' in 'boot.img'.
Using 7-zip on windows you can inspect the raw 'system.img', which includes permissions, file attributes and symlink targets.
If you go to 'File > Properties' you can also see additional drive and-or partition information, and hidden bits.
Setting attributes (noatime) to symlinks may be difficult with Linux and Unix, try Android (xattr
Cygwin symlinks are actual files, and can have file attributes (using 'chattr').
You can also run Lubuntu direct from live cd-dvd or usb.
If you need to install the 'VirtualBox Extension Pack', use Commader as Admin:
Helpful commands for Android, alter to suit, various commands also work with Commander, enjoy: