怎样将uboot添加到升级包update.zip中

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

怎样将uboot添加到升级包update.zip中

6,297 Views
ninglu
Contributor II

你好: 

   我们的平台时android4.4.2,kernel版本是linux3.0.35,使用的是imx6d的cpu。

 

   通过命令 make otapackage 可以生成升级包update.zip,但是这样,只能升级boot.img和system.img。我们想u-boot-6q.bin也能添加到update.zip中,与boot和system一起升级。

    请问能否实现,需要做哪些工作。

Labels (4)
0 Kudos
9 Replies

4,805 Views
liyu1
Contributor III

你好。

     我也遇到了类似问题,sysfs_file_write   、  simple_dd提示找不到这两个函数,请问你那有这两个函数的源码吗?

      如是有话,能不能分享一下。谢谢

0 Kudos

4,805 Views
jimmychan
NXP TechSupport
NXP TechSupport

In the Documentation files, there is "Android_Frequently_Asked_Questions.pdf". Please read the "39 How do I customize the update script to update uboot?"

i.MX 6 Series Software and Development Tool|NXP    

0 Kudos

4,808 Views
ninglu
Contributor II

jimmychan你好:

我通过修改make_update_zip.sh,能够在生成的update.zip中找到u-boot-6q.bin文件了。具体修改是:

将cat <(find {META-INF,system,data}/ -type d) <(find {META-INF,system,data}/ -type f) <(echo boot.img ) | zip -@ ${WD}/update.zip

修改为

cat <(find {META-INF,system,data}/ -type d) <(find {META-INF,system,data}/ -type f) <(echo boot.img) <(echo u-boot-6q.bin) | zip -@ ${WD}/update.zip

但是使用生成的update.zip或update-signed.zip,在reboot recovery时,都提示:

finding update package...

opening update package...

verifying update package ...

E:footer is wrong

E:signature verification failed

Installation aborted.

请问是什么原因呢

0 Kudos

4,808 Views
jimmychan
NXP TechSupport
NXP TechSupport
0 Kudos

4,808 Views
ninglu
Contributor II

现在的问题就是,uboot能够添加到update.zip中,并且能够签名成功,并且能够更新成功,但是更新成功后重启系统,发现uboot是最新的uboot了,但是却启动不了boot等,报如下错误

sd android update  test ==============
Writing to MMC(3)... done
charger mode
FEC0 [PRIME]
Hit any key to stop autoboot:  0  
booti: device don't have such partition:boot

我在updater-script里是这样加入uboot部分的,(加粗部分是我添加的)

ui_print("writting u-boot...");
sysfs_file_write("class/mmc_host/mmc0/mmc0:0001/boot_config", "1");
package_extract_file("u-boot-6q.bin", "/dev/block/mmcblk0");
sysfs_file_write("class/mmc_host/mmc0/mmc0:0001/boot_config", "0x10");
format("ext4", "EMMC", "/dev/block/mmcblk0p5", "0", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/system");
package_extract_dir("recovery", "/system");

请问是否还需要做其他修改呢

0 Kudos

4,808 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello nin lu,

     在使用MFG Tools时,有没有注意到ucl2.xml对应的list中,u-boot是有2个小分区的(xxxboot0/xxxboot1)?请去查一下看!从你的提示上看,似乎把这2个小分区给破坏掉了,造成了fastboot启动不了系统。

     虽然我们提供的updater.zip上没有对u-boot的更新,但是理论上,你的设想应该是可行的!所以,再努力一下看看!

NXP TIC team

Weidong

0 Kudos

4,808 Views
ninglu
Contributor II

hi Weidong Sun

   thank you very much!

    上述问题我已经解决了,现在能够正常的通过update.zip去更新u-boot-6q.bin,通过在uboot里添加打印信息,可以看到u-boot-6q.bin确实更新了。但是,现在遇到另一个问题:

就是uboot里的环境变量,即通过printenv打印出的哪些东西,是不会更新的。

这些环境变量是放在哪里的。怎样去擦除或者更新这些东西呢。

0 Kudos

4,808 Views
ninglu
Contributor II

jimmychan你好,

    谢谢,update.zip签名的问题已经解决了,现在遇到的问题是,由于修改了updater-script这个文件,添加了如下代码:

ui_print("writting u-boot...");
package_extract_file("files/u-boot-6q.bin", "/tmp/u-boot-6q.bin");
sysfs_file_write("class/mmc_host/mmc0/mmc0:0001/boot_config", "1");
simple_dd("/tmp/u-boot-6q.bin", "/dev/block/mmcblk0", 1024);
sysfs_file_write("class/mmc_host/mmc0/mmc0:0001/boot_config", "8");
show_progress(0.1, 5);

但是,好像package_extract_file这个命令并不能够执行。导致升级失败,lcd显示:

E:Error in “/cache/update.zip” state 6

我只保留

package_extract_file("files/u-boot-no-padding.bin", "/tmp/u-boot-6q.bin");

recovery升级过程就能顺利通过。但是升级成功后系统重启,uboot启动后报错:

sd android update  test ==============
Writing to MMC(3)... done
charger mode
FEC0 [PRIME]
Hit any key to stop autoboot:  0  
booti: device don't have such partition:boot
fastboot is in init......flash target is MMC:3
Bad partition index:1 for partition:boot
Bad partition index:2 for partition:recovery
Bad partition index:5 for partition:system
USB Mini b cable Connected!
fastboot initialized
USB_SUSPEND
USB_RESET
Invalid string index 238

请问updater-script这个文件需要怎样修改,添加u-boot-6q部分呢。

0 Kudos

4,808 Views
ninglu
Contributor II

你好,我找到了 How do I customize the update script to update uboot。

但是其中提到了make_update_zip.sh ~/mydroid ~/pdate-dir  ,我从android_build_env/make-update-zip.sh at master · faux/android_build_env · GitHub这里下载到了make_update_zip.sh这个文件,但是运行后,察看update.zip,里面并没有加入u-boot-6q.bin。以下是我的操作步骤,请看有什么问题,

(1)解压update.zip

   (2)将u-boot-6q.bin 放到解压出的update文件夹中,

   (3)修改updater_script 文件,在末尾加入

# Write u-boot to 1K position.

# u-boot binary should be a no padding uboot!

# For eMMC(iNand) device, needs to unlock boot partition.

ui_print("writting u-boot...");

package_extract_file("files/u-boot-6q.bin", "/tmp/u-boot-6q.bin");

sysfs_file_write("class/mmc_host/mmc0/mmc0:0001/boot_config", "1");

simple_dd("/tmp/u-boot-6q.bin", "/dev/block/mmcblk0", 1024);

sysfs_file_write("class/mmc_host/mmc0/mmc0:0001/boot_config", "8");

show_progress(0.1, 5);

(4) 将make_update_zip.sh放到update目录下

运行source make_update_zip.sh ,可以看到生成了update.zip和update-signed.zip。

但是在update.zip和update-signed.zip文件中,都没有找到u-boot-6q.bin文件。请问是操作步骤不对,还是make_update_zip.sh这个文件需要修改(若需要修改,怎样修改)。以下是这个文件的内容:

#!/bin/bash
WD=$(pwd)
echo WD=${WD}
OUT=${ANDROID_PRODUCT_OUT}
echo cleaning old files
rm -v update.zip update-signed.zip
cd ${OUT}
echo building update.zip
cat <(find {META-INF,system,data}/ -type d) <(find {META-INF,system,data}/ -type f) <(echo boot.img | u-boot-6q.bin )| zip -@ ${WD}/update.zip
cd ${WD}
echo ${WD}
echo $(pwd)
echo signing update.zip "->" update-signed.zip
java -jar ${ANDROID_BUILD_TOP}/out/host/linux-x86/framework/signapk.jar ${ANDROID_BUILD_TOP}/build/target/product/security/testkey.x509.pem ${ANDROID_BUILD_TOP}/build/target/product/security/testkey.pk8 update.zip update-signed.zip

0 Kudos