Change R/W Permission of "/system" partition while compiling image

351 views
Skip to first unread message

Mukund

unread,
Dec 16, 2010, 7:55:25 AM12/16/10
to Android-x86
Hello,

I want to mount "/system" partition as R/W permission So that i can
fire "adb sync" command from remote computer.
I would like to enable above option while making my android usb image.

Can anyone have any idea how to enable this support ?
It should be fine if it's done after installing usb image on my eeepc.

-- Mukund

Suman Saraf

unread,
Dec 16, 2010, 10:07:31 AM12/16/10
to andro...@googlegroups.com
If your system image is not squashfs compressed, I would presume you will just need to change 1 line in bootable/newinstaller/initrd/init

change the line try_mount ro to try_mount rw

If it is squashfs compressed you will need to hack in a few more lines into that script.


--- On Thu, 16/12/10, Mukund <muku...@gmail.com> wrote:

> --
> You received this message because you are subscribed to the
> Google Groups "Android-x86" group.
> To post to this group, send email to andro...@googlegroups.com.
> To unsubscribe from this group, send email to
> android-x86...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/android-x86?hl=en.
>
>



ady2k10

unread,
Dec 16, 2010, 7:27:51 PM12/16/10
to Android-x86
Hi Suman Saraf ,

If it is squashfs compressed, which few more lines should I change it
into that script?
Because I want to use rw filesystem on Android-xi86 too.
Thanks


On Dec 16, 10:07 pm, Suman Saraf <saraf_su...@yahoo.com> wrote:
> If your system image is not squashfs compressed, I would presume you will just need to change 1 line in bootable/newinstaller/initrd/init
>
> change the line try_mount ro to try_mount rw
>
> If it is squashfs compressed you will need to hack in a few more lines into that script.
>
> --- On Thu, 16/12/10, Mukund <mukund...@gmail.com> wrote:

Mukund

unread,
Dec 16, 2010, 11:16:16 PM12/16/10
to Android-x86
Hello Suman,

I was unable to find one line as you specified @ bootable/newinstaller/
initrd
Please note that i am using RAM Disk image to boot my eeepc.

Is there any other way to archived the same ?

Here is snap of script :

==================================================
#!/bin/busybox sh
#
# By Chih-Wei Huang <cwh...@linux.org.tw>
# Last updated 2010/09/13
#
# License: GNU Public License
# We explicitely grant the right to use the scripts
# with Android-x86 project.
#

try_mount()
{
RW=$1; shift
# FIXME: any way to mount ntfs gracefully?
mount -o $RW $@ || mount.ntfs-3g -o rw,force $@
}

if [ -n "$DEBUG" ]; then
LOG=/tmp/log
set -x
else
LOG=/dev/null
[ -e $LOG ] || busybox mknod $LOG c 1 3
fi
exec 2> $LOG

busybox mount -t proc proc /proc
busybox mount -t sysfs sys /sys

busybox --install -s

export PATH=$PATH:/system/bin

if [ -n "$DEBUG" -o -n "$INSTALL" ]; then
mknod /dev/tty2 c 4 2 && openvt
mknod /dev/tty3 c 4 3 && openvt
else
echo 0 0 0 0 > /proc/sys/kernel/printk
fi

echo -n Detecting Android-x86...

while [ 1 ]; do
mdev -s

for device in /dev/sr* /dev/sd[a-z]*; do
try_mount ro $device /mnt || continue
cd /mnt/$SRC
if [ ! -e ramdisk.img -o ! \( -e system.img -o -e
system.sfs \) ]; then
cd /
umount /mnt
continue
fi
mount -t tmpfs tmpfs /android
cd /android
zcat /mnt/$SRC/ramdisk.img | cpio -id > /dev/null
if [ -e /mnt/$SRC/system.sfs ]; then
mount -o loop /mnt/$SRC/system.sfs /sfs
mount -o loop /sfs/system.img system
else
mount -o loop /mnt/$SRC/system.img system
fi
mkdir cache mnt mnt/sdcard
mount -t tmpfs tmpfs cache
echo " found at $device"
break
done
mountpoint -q /android && break
sleep 1
echo -n .
done

ln -s android/system /

ln -s ../system/lib/modules /lib

if [ -n "$INSTALL" ]; then
cd /
zcat /mnt/$SRC/install.img | cpio -iud > /dev/null
fi

if [ -n "$DEBUG" -o -n "$BUSYBOX" ]; then
mv /bin /lib .
system/bin/ln -s android/lib /lib
system/bin/ln -s android/bin /bin
sed -i 's|\(PATH *\)\(/sbin\)|\1/bin:\2|' init.rc
mv /sbin/* sbin
rmdir /sbin
ln -s android/sbin /
else
ln -s ../android/sbin/hotplug /sbin
fi

if [ -n "$DEBUG" ]; then
echo -e "\nType 'exit' to continue booting...\n"
sh
fi

# load scripts
for s in `ls /scripts/* /mnt/$SRC/scripts/*`; do
source $s
done
====================================================

-- Mukund

slajeune

unread,
Dec 17, 2010, 8:56:02 AM12/17/10
to Android-x86
Hi Mukund,

to make /system read-write, you need to:

1- put this in your buildspec.mk:

USE_SQUASHFS := 0

This ensure that the systemm image isn't squash compressed

2- change this line in init:

try_mount ro $device /mnt || continue

to

try_mount rw $device /mnt || continue

Once this is done, rebuild your usb image and you should have a read
write /system partition. This is how I have set it on my end and it
works great.

Cheers,
Stephane.

On Dec 16, 11:16 pm, Mukund <mukund...@gmail.com> wrote:
> Hello Suman,
>
> I was unable to find one line as you specified @ bootable/newinstaller/
> initrd
> Please note that i am using RAM Disk image to boot my eeepc.
>
> Is there any other way to archived the same ?
>
> Here is snap of script :
>
> ==================================================
> #!/bin/busybox sh
> #
> # By Chih-Wei Huang <cwhu...@linux.org.tw>

Mukund

unread,
Dec 18, 2010, 1:10:17 AM12/18/10
to Android-x86
Hello slajeune,

Thanks. It works But Still have few problems :

I was not able to push modified files via "adb sync". I got error like
"No space left on device"
When i checked size of /system partition it shows me :
=============
/system 587195K total, 577267K used, 9934K available
==========

So, How to change "/system" size ?

-- Mukund

Mukund

unread,
Dec 20, 2010, 7:16:40 AM12/20/10
to Android-x86
Can anyone help me to change size of "system.img" while compiling ?

--Mukund

Suman Saraf

unread,
Dec 20, 2010, 8:08:22 AM12/20/10
to andro...@googlegroups.com

A hack might be to plant a big file in src/out/target/product/<your product>/system/<here>
Just create a big file with dd if=/dev/zero of=bigfile bs=4096 count=<>
and put it there. Then rebuild system.img and your installer.

After you install you can remove this big file and have the free blocks.


The other option is to change the script src/external/genext2fs/mkbootimg_ext2.sh.

That calculates the number of blocks and inodes and adds 1% extra. You can increase that extra to whatever you want. Search for `extra' in that script.

--- On Mon, 20/12/10, Mukund <muku...@gmail.com> wrote:

> From: Mukund <muku...@gmail.com>
> Subject: Re: Change R/W Permission of "/system" partition while compiling image
> To: "Android-x86" <andro...@googlegroups.com>

Mukund

unread,
Dec 20, 2010, 8:41:40 AM12/20/10
to Android-x86
Hello Suman,

I already checked option 1 as you specified but didn't got success.
Let me check option number 2

Thanks for you help.
Will back shortly with some results :)

-- Mukund

On Dec 20, 6:08 pm, Suman Saraf <saraf_su...@yahoo.com> wrote:
> A hack might be to plant a big file in src/out/target/product/<your product>/system/<here>
> Just create a big file with dd if=/dev/zero of=bigfile bs=4096 count=<>
> and put it there. Then rebuild system.img and your installer.
>
> After you install you can remove this big file and have the free blocks.
>
> The other option is to change the script src/external/genext2fs/mkbootimg_ext2.sh.
>
> That calculates the number of blocks and inodes and adds 1% extra. You can increase that extra to whatever you want. Search for `extra' in that script.
>
> --- On Mon, 20/12/10, Mukund <mukund...@gmail.com> wrote:
>
> > From: Mukund <mukund...@gmail.com>

Chih-Wei Huang

unread,
Dec 20, 2010, 8:09:41 PM12/20/10
to andro...@googlegroups.com
Don't struggle with these hacks.

Get the latest installer (by repo sync)
which support read-write installation.

2010/12/20 Mukund <muku...@gmail.com>:


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

Mukund

unread,
Dec 21, 2010, 12:02:48 AM12/21/10
to Android-x86
Hello Suman,

I tried 2nd option but no luck, system.img produced with same size as
earlier.

Please have a look on scrip portion, which I changed:

============================
# add 1%
extra=`expr $num_blocks / 1` # Removed 100
reserve=10
[ $extra -lt $reserve ] && extra=$reserve
==================


-- Mukund

Suman Saraf

unread,
Dec 21, 2010, 12:53:11 AM12/21/10
to andro...@googlegroups.com
Mukund,

I am not sure how you are going about trying these. I am attaching a sample screenshot of option 1 which I tried just now. I don't think you made a clean system.img after planting the bigfile. I don't have time just now to test option 2.

Anyways, I think you are better off following Chih-Wei's suggestion of using the new installer.

Suman


--- On Mon, 20/12/10, Mukund <muku...@gmail.com> wrote:

capture.png

Mukund

unread,
Dec 21, 2010, 8:32:02 AM12/21/10
to Android-x86
It's done.
Thanks Suman.

-- Mukund

On Dec 21, 10:53 am, Suman Saraf <saraf_su...@yahoo.com> wrote:
> Mukund,
>
> I am not sure how you are going about trying these. I am attaching a sample screenshot of option 1 which I tried just now. I don't think you made a clean system.img after planting the bigfile. I don't have time just now to test option 2.
>
> Anyways, I think you are better off following Chih-Wei's suggestion of using the new installer.
>
> Suman
>
>  capture.png
> 53KViewDownload
Reply all
Reply to author
Forward
0 new messages