How to change the initrd to mount the system.img with rootfs?

300 views
Skip to first unread message

fguy

unread,
Jun 17, 2019, 5:12:41 PM6/17/19
to Android-x86
Android 9 and 10 go to system.img, which contains in addition to the system folder and all the rootfs, which was previously in the ramdisk.img file. For Android 9, this "gift" can be locked with the key BOARD_BUILD_SYSTEM_ROOT_IMAGE. In Android 10 Beta 4, this key does not work and the system.img is always created with rootfs. Is it possible to modify the installation scripts in order to correctly mount such an image of the sys systems? The ramdisk image contains only the init file in the root.

fguy

unread,
Jun 17, 2019, 5:48:51 PM6/17/19
to Android-x86
Sorry. Is it possible to modify the installation scripts in order to correctly mount such an image as root dir?

Chih-Wei Huang

unread,
Jun 17, 2019, 10:52:18 PM6/17/19
to Android-x86
fguy <fguy...@gmail.com> 於 2019年6月18日 週二 上午5:48寫道:
>
> Sorry. Is it possible to modify the installation scripts in order to correctly mount such an image as root dir?

Surely it's possible.
You may modify the try_mount function in the init script.


--
Chih-Wei
Android-x86 project
http://www.android-x86.org

fguy

unread,
Jun 18, 2019, 3:00:06 AM6/18/19
to Android-x86

Surely it's possible.
You may modify the try_mount function in the init script.

I run the android in the form of a set of img files from a folder on drive C with ntfs via a refind (UEFI BIOS). As I understand it, I need to modify the function check_root (). In particular, the command "mount -o loop, noatime /sfs/system.img system" in line 112 (pie-x86). Replacing "system" with "." or "/" causes an error. Maybe you offer the right solution? 

Chih-Wei Huang

unread,
Jun 18, 2019, 4:44:55 AM6/18/19
to Android-x86
fguy <fguy...@gmail.com> 於 2019年6月18日 週二 下午3:00寫道:
>>
>> Surely it's possible.
>> You may modify the try_mount function in the init script.
>>
> I run the android in the form of a set of img files from a folder on drive C with ntfs via a refind (UEFI BIOS). As I understand it, I need to modify the function check_root (). In particular, the command "mount -o loop, noatime /sfs/system.img system" in line 112 (pie-x86). Replacing "system" with "." or "/" causes an error. Maybe you offer the right solution?

Don't change the mount point.
(surely . or / is not a valid mount point)
Just mount it as before and then switch_root (chroot) to it.

fguy

unread,
Jun 18, 2019, 9:18:42 AM6/18/19
to Android-x86

Don't change the mount point.
(surely . or / is not a valid mount point)
Just mount it as before and then switch_root (chroot) to it.

What to specify the 2nd parameter for switch_root - you must specify the file init. Or is it enough to run "chroot /system"?

Chih-Wei Huang

unread,
Jun 18, 2019, 10:16:51 PM6/18/19
to Android-x86
fguy <fguy...@gmail.com> 於 2019年6月18日 週二 下午9:18寫道:
That's the executable you want to run after switch_root (chroot).
For Android, it's always /init.

fguy

unread,
Jun 19, 2019, 4:53:46 PM6/19/19
to Android-x86

That's the executable you want to run after switch_root (chroot).
For Android, it's always /init.

I assembled a pie-x86 with the key "BOARD_BUILD_SYSTEM_ROOT_IMAGE: = true". System.img turned out with rootfs, and ramdisk.img remained the same with rootfs. When booting from debug in the console, it can be seen that the system.img with rootfs is not mounted to the folder /system.
Reply all
Reply to author
Forward
0 new messages