Tweaking Froyo for Nitrogen Part 2: sound and media
Published on August 30, 2010
In my previous post, I walked through the process of configuring touch support, so the system is now usable. You should be able to load up the settings pages to change the screen brightness and timeout.
You'll be disappointed if you try to set up any of the sounds though: there aren't any installed. If you run adb logcat
you'll see that Android complains about missing audio files:
user@host:~$ adb logcat "V:*" | grep ogg
E/SoundPool( 2066): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 2066): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 2066): error loading /system/media/audio/ui/KeypressStandard.ogg
W/AudioService( 2066): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
E/SoundPool( 2066): error loading /system/media/audio/ui/KeypressSpacebar.ogg
W/AudioService( 2066): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
E/SoundPool( 2066): error loading /system/media/audio/ui/KeypressDelete.ogg
W/AudioService( 2066): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
E/SoundPool( 2066): error loading /system/media/audio/ui/KeypressReturn.ogg
W/AudioService( 2066): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
D/Eas Debug( 2299): Logging:
^C
This can be addressed by adding to the PRODUCT_COPY_FILES
variable in device/fsl/imx5x.mk
:
diff --git a/imx5x/imx5x.mk b/imx5x/imx5x.mk index e624f09..8eb3fcb 100644 --- a/imx5x/imx5x.mk +++ b/imx5x/imx5x.mk @@ -20,6 +20,13 @@ PRODUCT_COPY_FILES += device/fsl/imx5x/vold.fstab:system/etc/vold.fstab device/fsl/imx5x/mxckpd.kl:system/usr/keylayout/mxckpd.kl device/fsl/imx5x/Dell_Dell_USB_Keyboard.kl:system/usr/keylayout/Dell_Dell_USB_Keyboard.kl + +PRODUCT_COPY_FILES += + frameworks/base/data/sounds/effects/Effect_Tick.ogg:system/media/audio/ui/Effect_Tick.ogg + frameworks/base/data/sounds/effects/KeypressStandard.ogg:system/media/audio/ui/KeypressStandard.ogg + frameworks/base/data/sounds/effects/KeypressSpacebar.ogg:system/media/audio/ui/KeypressSpacebar.ogg + frameworks/base/data/sounds/effects/KeypressDelete.ogg:system/media/audio/ui/KeypressDelete.ogg + frameworks/base/data/sounds/effects/KeypressReturn.ogg:system/media/audio/ui/KeypressReturn.ogg PRODUCT_COPY_FILES += device/fsl/imx5x/init.rc:root/init.rcAlso, if you browse for media on the device, you'll notice not only that there isn't any, you should also see that the
/media/MEDIA
partition isn't mounted as /media
. Instead, the first FAT (boot) partition is mounted:
# mount
rootfs / rootfs rw 0 0
tmpfs /dev tmpfs rw,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/shm tmpfs rw,relatime,size=1024k,mode=775,uid=1000,gid=1003 0 0
/dev/block/mmcblk0p2 /system ext3 rw,relatime,errors=continue,data=writeback 0 0
/dev/block/mmcblk0p5 /data ext3 rw,nosuid,nodev,relatime,errors=continue,data=writeback 0 0
/dev/block/mmcblk0p6 /cache ext3 rw,nosuid,nodev,relatime,errors=continue,data=writeback 0 0
/dev/block/vold/179:1 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:1 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
You can edit the file device/fsl/imx5x/init.rc
to fix this. While doing so, you'll probably want to change /system
to be read-write and mount the boot partition. Mounting /system
as read-write will allow you to use adb sync
and mounting /boot
will allow you to use adb push
. Each of these tools is very handy.
Putting all of these changes together yields a patch like this:
ericn@ericsony:~/myandroid/device/fsl$ git diff imx5x/init.rc diff --git a/imx5x/init.rc b/imx5x/init.rc index 3ca87af..a0de583 100755 --- a/imx5x/init.rc +++ b/imx5x/init.rc @@ -101,7 +101,7 @@ loglevel 3 # mount ext3 partitions # Mount /system rw first to give the filesystem a chance to save a checkpoint mount ext3 /dev/block/mmcblk0p2 /system - mount ext3 /dev/block/mmcblk0p2 /system ro remount + #mount ext3 /dev/block/mmcblk0p2 /system ro remount # We chown/chmod /data again so because mount is run as root + defaults mount ext3 /dev/block/mmcblk0p5 /data nosuid nodev @@ -132,6 +132,17 @@ loglevel 3 chown system cache /cache chmod 0770 /cache + # Same reason as /data above + mount vfat /dev/block/mmcblk0p7 /media nosuid nodev + chown system sdcard_rw /media + chmod 0770 /media + + # Mount first partition as /boot + mkdir /boot 0775 root system + mount vfat /dev/block/mmcblk0p1 /boot nosuid nodev + chown system sdcard_rw /boot + chmod 0770 /boot + # This may have been created by the recovery system with odd permissions chown system cache /cache/recovery chmod 0770 /cache/recoveryThere's one more piece to the puzzle: the file
vold.fstab
in the imx5x/
directory contains another reference to /mnt/sdcard
and needs to have the partition number changed from 1
to 7
:
diff --git a/imx5x/vold.fstab b/imx5x/vold.fstab index 6578b04..1f0eb15 100644 --- a/imx5x/vold.fstab +++ b/imx5x/vold.fstab @@ -14,7 +14,7 @@ ## Example of a standard sdcard mount for the emulator / Dream # Mounts the first usable partition of the specified device -dev_mount sdcard /mnt/sdcard 1 /devices/platform/mxsdhci.0/mmc_host/mmc0 +dev_mount sdcard /mnt/sdcard 7 /devices/platform/mxsdhci.0/mmc_host/mmc0 ## Example of a dual card setup # dev_mount left_sdcard /sdcard1 auto /devices/platform/goldfish_mmc.0 /devices/platform/msm_sdcc.2/mmc_host/mmc1Once you've gone through all of this, you should be able to
adb push
files to the /sdcard/
folder. We haven't done a lot of testing, but .3gp
videos and .mp3
and .ogg
audio files seem to play well.