Update Bootloader In An OTA

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Update Bootloader In An OTA

1,594 Views
ningli
Contributor III

Hi,

 

Maybe some one can Help me with this. I am trying to update the bootloader in an OTA (update.zip). I modified the updater_script and also modified simple_dd to skip 1K bytes from input file,but i don't know if is it right. Is there anyone who might be able to tell if this updater_script is correct? I added the section at the end about u-boot. I am using Android 4.4.2 and linux kernel 3.0.35

show_progress(0.500000, 0);
mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/system");
run_program("/system/bin/busybox","cp","-af","/system/vendor/firmware/imx","/cache/");
package_extract_file("u-boot.bin","/tmp/u-boot.bin");
package_extract_file("logo.bmp","/tmp/logo.bmp");
run_program("/system/bin/busybox","dd","if=/tmp/u-boot.bin","of=/dev/block/mmcblk0","bs=1024","skip=1","seek=1");
run_program("/system/bin/busybox","dd","if=/tmp/logo.bmp","of=/dev/block/mmcblk0","bs=1024","seek=7168");
unmount("/system");
format("ext4", "EMMC", "/dev/block/mmcblk0p5", "0", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/system");
package_extract_dir("recovery", "/system");
package_extract_dir("system", "/system");
symlink("Roboto-Bold.ttf", "/system/fonts/DroidSans-Bold.ttf");
symlink("Roboto-Regular.ttf", "/system/fonts/DroidSans.ttf");
symlink("libGLESv2.so", "/system/lib/libGLESv3.so");
symlink("mksh", "/system/bin/sh");
symlink("toolbox", "/system/bin/cat", "/system/bin/chcon",
"/system/bin/chmod", "/system/bin/chown", "/system/bin/clear",
"/system/bin/cmp", "/system/bin/cp", "/system/bin/date",
"/system/bin/dd", "/system/bin/df", "/system/bin/dmesg",
"/system/bin/du", "/system/bin/getenforce", "/system/bin/getevent",
"/system/bin/getprop", "/system/bin/getsebool", "/system/bin/grep",
"/system/bin/hd", "/system/bin/id", "/system/bin/ifconfig",
"/system/bin/iftop", "/system/bin/insmod", "/system/bin/ioctl",
"/system/bin/ionice", "/system/bin/kill", "/system/bin/ln",
"/system/bin/load_policy", "/system/bin/log", "/system/bin/ls",
"/system/bin/lsmod", "/system/bin/lsof", "/system/bin/md5",
"/system/bin/mkdir", "/system/bin/mkswap", "/system/bin/mount",
"/system/bin/mv", "/system/bin/nandread", "/system/bin/netstat",
"/system/bin/newfs_msdos", "/system/bin/notify", "/system/bin/printenv",
"/system/bin/ps", "/system/bin/readlink", "/system/bin/renice",
"/system/bin/restorecon", "/system/bin/rm", "/system/bin/rmdir",
"/system/bin/rmmod", "/system/bin/route", "/system/bin/runcon",
"/system/bin/schedtop", "/system/bin/sendevent",
"/system/bin/setconsole", "/system/bin/setenforce",
"/system/bin/setprop", "/system/bin/setsebool", "/system/bin/sleep",
"/system/bin/smd", "/system/bin/start", "/system/bin/stop",
"/system/bin/swapoff", "/system/bin/swapon", "/system/bin/sync",
"/system/bin/top", "/system/bin/touch", "/system/bin/umount",
"/system/bin/uptime", "/system/bin/vmstat", "/system/bin/watchprops",
"/system/bin/wipe");
set_metadata_recursive("/system", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/bin", "uid", 0, "gid", 2000, "dmode", 0755, "fmode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/bin/app_process", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:zygote_exec:s0");
set_metadata("/system/bin/clatd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:clatd_exec:s0");
set_metadata("/system/bin/debuggerd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:debuggerd_exec:s0");
set_metadata("/system/bin/dhcpcd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dhcp_exec:s0");
set_metadata("/system/bin/dnsmasq", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:dnsmasq_exec:s0");
set_metadata("/system/bin/drmserver", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:drmserver_exec:s0");
set_metadata("/system/bin/hostapd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:hostapd_exec:s0");
set_metadata("/system/bin/installd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:installd_exec:s0");
set_metadata("/system/bin/keystore", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:keystore_exec:s0");
set_metadata("/system/bin/mediaserver", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mediaserver_exec:s0");
set_metadata("/system/bin/mksh", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:shell_exec:s0");
set_metadata("/system/bin/mtpd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:mtp_exec:s0");
set_metadata("/system/bin/netcfg", "uid", 0, "gid", 3003, "mode", 02750, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/bin/netd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:netd_exec:s0");
set_metadata("/system/bin/ping", "uid", 0, "gid", 0, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ping_exec:s0");
set_metadata("/system/bin/pppd", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:ppp_exec:s0");
set_metadata("/system/bin/racoon", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:racoon_exec:s0");
set_metadata("/system/bin/rild", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:rild_exec:s0");
set_metadata("/system/bin/run-as", "uid", 0, "gid", 2000, "mode", 0750, "capabilities", 0xc0, "selabel", "u:object_r:runas_exec:s0");
set_metadata("/system/bin/sdcard", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:sdcardd_exec:s0");
set_metadata("/system/bin/servicemanager", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:servicemanager_exec:s0");
set_metadata("/system/bin/surfaceflinger", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:surfaceflinger_exec:s0");
set_metadata("/system/bin/vold", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:vold_exec:s0");
set_metadata("/system/bin/wpa_supplicant", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:wpa_exec:s0");
set_metadata_recursive("/system/etc/dhcpcd", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:dhcp_system_file:s0");
set_metadata("/system/etc/dhcpcd/dhcpcd-run-hooks", "uid", 1014, "gid", 2000, "mode", 0550, "capabilities", 0x0, "selabel", "u:object_r:dhcp_system_file:s0");
set_metadata("/system/etc/install-recovery.sh", "uid", 0, "gid", 0, "mode", 0544, "capabilities", 0x0);
set_metadata_recursive("/system/etc/ppp", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0555, "capabilities", 0x0, "selabel", "u:object_r:ppp_system_file:s0");
set_metadata("/system/recovery-from-boot.p", "uid", 0, "gid", 0, "mode", 0644, "capabilities", 0x0);
set_metadata("/system/vendor", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/vendor/etc", "uid", 0, "gid", 2000, "dmode", 0755, "fmode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/vendor/etc/audio_effects.conf", "uid", 0, "gid", 0, "mode", 0644, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata("/system/vendor/firmware", "uid", 0, "gid", 2000, "mode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
set_metadata_recursive("/system/xbin", "uid", 0, "gid", 2000, "dmode", 0755, "fmode", 0755, "capabilities", 0x0, "selabel", "u:object_r:system_file:s0");
show_progress(0.200000, 0);
show_progress(0.200000, 10);
package_extract_file("boot.img", "/dev/block/mmcblk0p1");
show_progress(0.100000, 0);
unmount("/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/system");
package_extract_file("u-boot.bin","/tmp/u-boot.bin");
sysfs_file_write("class/mmc_host/mmc0/mmc0:0001/boot_config", "1");
simple_dd("/tmp/u-boot.bin", "/dev/block/mmcblk0", 1024, 1024);
sysfs_file_write("class/mmc_host/mmc0/mmc0:0001/boot_config", "8");
run_program("/system/bin/busybox","cp","-af","/cache/imx","/system/vendor/firmware/");
run_program("/system/bin/busybox","rm","-rf","/cache/imx");
run_program("/system/bin/busybox","rm","-f","/cache/update.zip");
set_metadata("/system/vendor/firmware/imx", "uid", 0, "gid", 0, "mode", 0644, "capabilities", 0x0);
unmount("/system");

I have saw this text https://community.nxp.com/message/399559 already, but still fail.

I run this script and work ok. But bootloader still is old version in EMMC. Anyone can help please! ! !

Labels (2)
0 Kudos
4 Replies

1,025 Views
diegoadrian
NXP Employee
NXP Employee

Hello Ning Li,

Sorry for the delay, but my building computer was busy with a process that I couldn't stop.

Probably, those commands are not supported by the recovery mode. I will try to enter the recovery mode and see if I could run those commands.

Best Regards,

Diego.

0 Kudos

1,025 Views
ningli
Contributor III

Hi Diego,

Thank you for your repling me. Don't worry about it. You can do it when you are convenient.

0 Kudos

1,025 Views
ningli
Contributor III

Hi Diego,

I am glad to read your reply. I have resolved it. But there are some problem that  I have not got it.

I add sysfs_file_write and simple_ddd funcitons,but they didn't work well.

Finally, I get the right method to solve my case.

I am using is .

sysfs_file_write("block/mmcblk0boot0/force_ro", "0");
run_program("/system/bin/busybox","dd","if=/tmp/u-boot.bin","of=/dev/block/mmcblk0boot0","bs=1024","skip=1","seek=1");
sysfs_file_write("block/mmcblk0boot0/force_ro", "1");

Now in my case. In recovery mode , series port can't get any log and run_program("/system/bin/busybox","echo","block/mmcblk0boot0/force_ro", "0"); can't work. 

This is all my know. Hope helpful for you.

Best Regards,

Ning.

0 Kudos

1,025 Views
diegoadrian
NXP Employee
NXP Employee

Hello Ning Li,

Thank you for writing.

I do not know if you are still having problems with this.

However, I will try to reproduce this problem by myself.

Best Regards,

Diego.

0 Kudos