Page 1 of 1

Boot from SD Card with modified u-boot [ANSWERED]

Posted: Mon Jul 17, 2017 2:07 am
by brendan
Hello,

I am looking at replicating the VAR SOM MX6 recovery SD card: http://variwiki.com/index.php?title=VAR ... rd_V70plus

I have a Yocto generated image which can be flashed onto the NAND flash which is fully functional. I also have a modified u-boot image which I manually flash together with the SPL onto the NAND flash using:
$ flash_erase /dev/mtd0 0 0
$ kobs-ng init -x SPL --search_exponent=1 -v
$ flash_erase /dev/mtd1 0 0
$ nandwrite -p /dev/mtd1 u-boot.img

Taken from: http://variwiki.com/index.php?title=VAR ... ash_U-BOOT

I am looking at using my own image to perform the same functionalities as the recovery SD card image, I have therefore included the kobs-ng and flash_erase functions using the imx-kobs and mtd-utils/mtd-utils-ubifs additions within Yocto.

I included sdcard in the list of IMAGE_FSTYPES within Yocto which produces the appropriate .sdcard file which I can then write onto my SD card using dd.

The issue I have here is that it is using the default u-boot.img and SPL when booting from the SD card. I am looking to have the .sdcard file type to include my modified u-boot.img. I tried following this guide: http://www.variwiki.com/index.php?title ... le_SD_card however am not having any luck.

Do I need to include the modified u-boot and SPL files within the .sdcard output file prior to writing it onto the SD card?

Any help would be greatly appreciated.

Re: Boot from SD Card with modified u-boot

Posted: Mon Jul 17, 2017 6:19 am
by Eran.M
Hi brendan.
Please follow the following instructions: Create an extended SD card
But before running the var-create-yocto-sdcard.sh script, replace all of the SPL and U-Boot images (two SPL images and two U-Boot images, one of each for SD card and one for NAND flash) under build/tmp/deploy/images/var-som-mx6/, with your own.

Regards,
Eran

Re: Boot from SD Card with modified u-boot [ANSWERED]

Posted: Mon Jul 17, 2017 7:44 am
by brendan
Hi Eran,

Could you please clarify; when I build my image within Yocto with the sdcard IMAGE_FSTYPE enabled
IMAGE_FSTYPES = " tar.bz2 ubi ubifs sdcard"


that the output image with the .sdcard still requires the create-yocto-sdcard.sh script to be executed as well? I just assumed that when supplying an sdcard IMAGE_FSTYPE that it automatically runs the script to generate the .sdcard image. The modified SPL and U-Boot images are already sitting in my tmp/deploy/images/var-som/mx6/ directory.

I am just having a little bit of trouble understanding the process so I apologise in advance.

Re: Boot from SD Card with modified u-boot [ANSWERED]

Posted: Mon Jul 17, 2017 9:15 am
by Eran.M
The .sdcard file does not contain our recovery scripts and icons.
The "extended SD card" script doesn't use the .sdcard file - it creates the SD card directly using the U-Boot, kernel, filesystem images, etc.

The differences are explained here:
http://www.variwiki.com/index.php?title ... le_SD_card

Re: Boot from SD Card with modified u-boot [ANSWERED]

Posted: Tue Jul 18, 2017 12:53 am
by brendan
Thank you, that clears things up for me.

I have another question, however unsure whether I should start a new thread or not.

I am following these instructions: http://variwiki.com/index.php?title=VAR ... ng_to_NAND

using the recovery SD card to manually flash the NAND. I understand that I can replace the default SPL, uBoot and uImage files with my own, however the SOM has a different mtd partition layout than the default setting. What would be the best way to replicate the example in the link and flash a different mtd partition (for example if my kernel sits in mtd6 rather than Variscite's default of mtd2). Would I have to flash the NAND with my modified device tree (modified mtd partition table) first prior to doing the kobs-ng/nandwrite functions following that?

Thanks

Re: Boot from SD Card with modified u-boot [ANSWERED]

Posted: Tue Jul 18, 2017 8:50 am
by Eran.M
You can either modify the device tree or add an mtdparts parameter to the bootargs in U-Boot.
For example:
setenv mmcargs ${mmcargs} mtdparts=gpmi-nand:2m(spl),2m(uboot),2m(uboot-env),250m(os1),250m(os2),-(settings)