This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/DRA746: How does ULO load linux image in ram and run it

Part Number: DRA746


Tool/software: Linux

Received the following questions from the customer after providing the Linux Core U-Boot guide here: 

http://processors.wiki.ti.com/index.php/Linux_Core_U-Boot_User's_Guide

This apparently does not provide the fastboot inof needed and so their questions are: 

  1. How to enable the compile flags to have the fastboot-enabled ULO (Uboot-spl.bin)?
  2. How to use the fastboot to load the whole system into RAM and then boot from RAM? What they learned is that the normal fastboot should be able to support:

 

 boot <kernel> [ <ramdisk> ]              download and boot kernel

 

              Does our fastboot support above command to load kernel and ramdisk into RAM?

  • Hi John,

    which SDK they use?

    Regards,
    Yordan
  • Hi Yordan,

    The SDK version is v3.02.00.03.

    Regards

    Kevin

  • Hi John,

    I have forwarded your question to bootloader expert.

    Regards,
    Yordan
  • Hi Yordan,

    Have you any update about this post? It will be an urgent case soon. So please have your support for this issue. thank you!

    Best Regards

    Kevin

  • Hi John,

    Fastboot isn't supported in the MLO, but is available on u-boot. The single-stage boot loader has constraints on size, and thus fastboot support exists using two stage boot.

    Regarding flashing the whole file-system on RAM we haven't tested this out. Images are flashed to permanent storage using fastboot, but not directly to RAM. I will discuss with the team on the feasibility and shall revert.

    Regarads
    Shravan
  • The same U-boot (p-ti-u-boot-2016.05) Is used for Proc Linux and Android  Automotive SDKs for DRA7x platform variants.

    Only the partition table is different for linux and android ( Ref: include/configs/dra7xx_evm.h).

    commands

    1) fastboot flash boot boot.img

    bootimg is ( ramdisk.img + zImage)

    and

    2) fastboot flash zImage zImage 

    is tested with android builds (with bootmedia as eMMA) and the equivalent commands for fastboot flashing should work for linux images too 

  • Hi Praneeth,

    Nice to receive your response. This is my first time to touch the way of loading kernel image to ram and run it. So I have many questions. Maybe all questions are easy for you but I would like to have your instruction and supports. Thank you! Below is my questions.

    1) How do we get the "p-ti-u-boot-2016.05"? Does SDK support it in default? 

    2)  How do I combine ramdisk.img + zImage to be boot.img?

    If possible, could you provide related doc or sop to describe this part like ULO? Thank you!

    Best Regards

    Kevin

  • Hi Kevin,

    Please follow the steps listed below to create an image containing the kernel+ramdisk.

    processors.wiki.ti.com/.../Initrd


    Regards
    Shravan
  • Hi Shruavan,
    Thank you for your reply. We have buint the image but we still have problem about the "p-ti-u-boot-2016.05". We directly use default u-boot of SDK but the fastboot command (installed by sudo apt-get install android-tools-fastboot) cannot transfer to uboot. So we have below questions:

    1) How do we get the "p-ti-u-boot-2016.05"? Does SDK support it in default? Or we have to configure it by manuconfig?
    2) How do we make sure if p-ti-u-boot-2016.05 is running? Does it present an interface port in PC like PC can detect the interface port when Android systme in the fastboot mode.

    Best Regards
    Kevin
  • Hi Kevin,

    'p-ti-u-boot-2016.05' is the default u-boot with Processor-SDK 3.02.
    Are you able to get to u-boot? Can you copy the MLO and u-boot.img to an SD-card and boot using the SD card to ensure that the images are fine?
    Once this is validated, you can run the below command from u-boot to find u-boot version using fastboot.

    > fastboot getvar bootloader-version

    Can you please confirm if you're able to run these steps? You can find more information on fastboot in the file 'README.android-fastboot' in the 'doc' folder of the u-boot repository.

    Regards
    Shravan
  • Hi Shravan,
    Thank you for your reply. I will try it and update my status for you soon. Thank you!

    Best regards
    Kevin
  • Hi Shravan,

    I have using USB Device Firmware Upgrade (DFU) to load u-boot.img by using following method.

     

    And I check version under u-boot and got following message.

    => version

    U-Boot 2016.05 (Nov 24 2017 - 15:38:03 +0800)
    arm-linux-gnueabihf-gcc (Linaro GCC 5.3-2016.02) 5.3.1 20160113
    GNU ld (GNU Binutils) 2.25.0 Linaro 2015_10

    It means that I can get to uboot, am i correct?

    Then I try command fastboot getvar bootloader-version, but I got following message.

    => fastboot
    fastboot - use USB Fastboot protocol

    Usage:
    fastboot <USB_controller>
    - run as a fastboot usb device

    1. Is there has any setting or config I need to set?

    2. And is there has another way other than fastboot to load zImage to RAM (not MMC/SD) and run it?

    BTW, SDK I used is SDK v3.02 OS: Linux

    Best Regards
    Kevin

  • Hi Kevin,

    Yes you're on the right version, and I can see fastboot is already built as part of the image. Now from u-boot on the target run:

    U-boot# fastboot 0

    This enables the board to receive images from the PC using fastboot. Run the below command from your target to transfer the boot image (ramdisk + zImage) from the PC 

    PC# fastboot flash boot boot.img 

    Regards
    Shravan

  • Hi Shravan,

    Thanks for your prompt reply.

    I try to send fastboot 0, but got message as below. And no fastboot device found on PC side.
    => fastboot 0
    UNKNOWN IRQ type 1887007331

    1. Is there has any setting or config I need to set?

    Best Regards
    Kevin
  • Hi Kevin,

    On your PC can you please run the below command

    PC# fastboot devices

    You may need sudo permissions to run the above command.

    You should see a device that shows up. Can you confirm this? If not, please make sure you've connected a micro-USB cable next to the HDMI port on the base-board.

    Regards
    Shravan
  • Hi Shravan,

    Thanks for your reply as usual.

    I can use fastboot flash now.
    albert@albert-PC:~/bowei$ sudo fastboot flash zImage /home/albert/Wess/zImage
    target reported max download size of 788529152 bytes
    sending 'zImage' (4184 KB)...
    OKAY [ 0.208s]
    writing 'zImage'...
    FAILED (remote: Cannot find boot partition)
    finished. total time: 0.266s
    albert@albert-PC:~/bowei$ sudo fastboot flash boot /home/albert/Wess/Image
    target reported max download size of 788529152 bytes
    sending 'boot' (13308 KB)...
    OKAY [ 0.629s]
    writing 'boot'...
    FAILED (remote: cannot find partition)
    finished. total time: 0.666s

    But I have one more question is about partition setting.
    In what file I can setup my partition table? (include/configs/dra7xx_evm.h or others?)
    Is there has any document I can reference?

    Best Regards
    Kevin
  • Hi Kevin,

    Yes, you need to setup the partition table in the 'include/configs/dra7xx_evm.h' file. Changes has to be made to the 'PARTS_DEFAULT' macro.  

    Please refer to 'doc/README.android-fastboot-protocol' file in u-boot, for more information.

    Regards

    Shravan

  • Hi Shravan,

    I try to add PARTS_DEFAULT macro under '#ifdef CONFIG_SPL_DFU_SUPPORT' in 'dra7xx_evm.h'.
    #define PARTS_DEFAULT \
    /* Linux partitions */ \
    "uuid_disk=${uuid_gpt_disk};" \
    "name=boot,start=2MiB,size=10M,uuid=${uuid_gpt_boot};" \
    "name=rootfs,size=-,uuid=${uuid_gpt_rootfs}\0" \
    /* Android partitions */ \
    "partitions_android=" \
    "uuid_disk=${uuid_gpt_disk};" \
    "name=xloader,start=128K,size=128K,uuid=${uuid_gpt_xloader};" \
    "name=bootloader,size=768K,uuid=${uuid_gpt_bootloader};" \
    "name=environment,size=128K,uuid=${uuid_gpt_environment};" \
    "name=misc,size=128K,uuid=${uuid_gpt_misc};" \
    "name=reserved,size=384K,uuid=${uuid_gpt_reserved};" \
    "name=efs,size=16M,uuid=${uuid_gpt_efs};" \
    "name=crypto,size=16K,uuid=${uuid_gpt_crypto};" \
    "name=recovery,size=10M,uuid=${uuid_gpt_recovery};" \
    "name=boot,size=10M,uuid=${uuid_gpt_boot};" \
    "name=system,size=768M,uuid=${uuid_gpt_system};" \
    "name=cache,size=256M,uuid=${uuid_gpt_cache};" \
    "name=ipu1,size=8M,uuid=${uuid_gpt_ipu1};" \
    "name=ipu2,size=8M,uuid=${uuid_gpt_ipu2};" \
    "name=dsp1,size=8M,uuid=${uuid_gpt_dsp1};" \
    "name=dsp2,size=8M,uuid=${uuid_gpt_dsp2};" \
    "name=userdata,size=-,uuid=${uuid_gpt_userdata}"

    but when I do fastboot flash it still unable to flash, and show following log on j6 side.

    WARNING: unknown variable: partition-type:boot
    request fdf3c400 was not queued to ep1in-bulk
    request fdf3c400 was not queued to ep1in-bulk
    Starting download of 13627392 bytes
    request fdf3c400 was not queued to ep1in-bulk
    ..........................................................................
    .............................request fdf3c400 was not queued to ep1in-bulk

    downloading of 13627392 bytes finished
    GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
    part_get_info_efi: *** ERROR: Invalid GPT ***
    GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
    part_get_info_efi: *** ERROR: Invalid Backup GPT ***
    ERROR: cannot find partition: 'boot'

    at common/fb_mmc.c:136/fb_mmc_flash_write()
    request fdf3c400 was not queued to ep1in-bulk

    WARNING: unknown variable: partition-type:zImage
    request fdf3c400 was not queued to ep1in-bulk
    request fdf3c400 was not queued to ep1in-bulk
    Starting download of 4285368 bytes
    request fdf3c400 was not queued to ep1in-bulk
    ................................request fdf3c400 was not queued to ep1in-bulk

    downloading of 4285368 bytes finished
    Flashing zImage...4285368 bytes
    GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
    part_get_info_efi: *** ERROR: Invalid GPT ***
    GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
    part_get_info_efi: *** ERROR: Invalid Backup GPT ***
    request fdf3c400 was not queued to ep1in-bulk
    GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
    part_get_info_efi: *** ERROR: Invalid GPT ***
    GUID Partition Table Header signature is wrong: 0x0 != 0x5452415020494645
    part_get_info_efi: *** ERROR: Invalid Backup GPT ***
    status: -104 ep 'ep1in-bulk' trans: 0

    And I also try to add Fastboot config, but found that it only support MMC and NAND.
    #define CONFIG_USB_FUNCTION_FASTBOOT
    #define CONFIG_CMD_FASTBOOT
    #define CONFIG_FASTBOOT_BUF_ADDR CONFIG_SYS_LOAD_ADDR
    #define CONFIG_FASTBOOT_BUF_SIZE 0x2F000000
    #define CONFIG_FASTBOOT_FLASH
    #define CONFIG_FASTBOOT_FLASH_MMC_DEV 1

    1. Am I add PARTS_DEFAULT macro in right place? And what value I should set for start(start=2MiB) value?
    2. What Fastboot config I should define to flash image to RAM or it is not related?


    Best Regards
    Kevin
  • Hi Kevin,

    Since you want to load image to RAM and boot from it, run the below command from the PC

    PC@:~ fastboot boot <boot image> 

    Flashing images is only when you want to write to storage (emmc/SPI). Incase you want to flash the images, please set the device to which it needs to be flashed (by default its emmc), but running the below commands from the PC. 

    PC@:~ fastboot oem mmc -- Set the flashing device to emmc

    PC@:~ fastboot oem spi -- Set the flashing device to QSPI

    Then you can run the subsequent commands to flash MLO/boot.img etc.


    Regards
    Shravan

  • Hi Shravan,

    Thanks for your reply.

    After I send command fastboot boot boot.img from PC side.
    J6 only show following message and no other action.
    Starting download of 13629440 bytes
    request fdf3c400 was not queued to ep1in-bulk
    ..........................................................................
    .............................request fdf3c400 was not queued to ep1in-bulk

    downloading of 13629440 bytes finished
    request fdf3c400 was not queued to ep1in-bulk
    Booting kernel..
    ## Booting Android Image at 0x82000000 ...
    Kernel load addr 0x82000800 size 13308 KiB
    XIP Kernel Image ... OK

    Starting kernel ...

    1. Is there has any setting I need to set or somethings I need to do?(Chang image format?)


    Best Regards
    Kevin
  • Hi Kevin,

    How are you creating the boot image? I notice that the kernel load address is 0x82000000. By default Linux Kernel is loaded at 0x80000000. In android the boot.img is created using the mkbootimage tool (can be used for Processor SDK Linux as well). Set the below parameters

    BOARD_KERNEL_BASE := 0x80000000

    BOARD_KERNEL_OFFSET := 0x00008000 //Default in mkbootimage tool

    BOARD_MKBOOTIMG_ARGS := --ramdisk_offset 0x03000000

    You should see the below logs from u-boot:

     

    Kernel load addr 0x80008000 size 7529 KiB

    Kernel command line: buildvariant=userdebug

    RAM disk load addr 0x83000000 size 1004 KiB

    Regards

    Shravan

  • Hi Shravan,

    Thanks for your reply.

    I make boot.img as follow:
    mkbootimg --kernel /home/wess/LGA/lga_3.02.00.03/board-support/linux/arch/arm/boot/zImage --ramdisk ramdisk.gz --base 0x80000000 --ramdisk_offset 0x03000000 -o boot.img

    (use empty ramdisk)
    processors.wiki.ti.com/.../Initrd

    Fastboot as follow:
    sudo fastboot -b 0x80000000 -c "buildvariant=userdebug" boot /home/albert/Wess/boot.img

    And j6 shows log as follow:
    downloading of 4360192 bytes finished
    request fdf3d400 was not queued to ep1in-bulk
    Booting kernel..
    ## Booting Android Image at 0x82000000 ...
    Kernel load addr 0x80008000 size 4186 KiB
    Kernel command line: buildvariant=userdebug
    RAM disk load addr 0x83000000 size 69 KiB
    Loading Kernel Image ... OK

    Starting kernel ...

    But still not boot into kernel.

    1. Is there has anything I need to set to kernel config or put something in ramdisk?
    2. Is it relate to zImage and RAM disk size?


    Best Regards
    Kevin
  • Hi Shravan,

    Add u-boot env parameter and machid & r2 value send from kernel_entry function for your reference.
    Hope these can help to find the reason.

    => print
    arch=arm
    args_fit=setenv bootargs console=${console}
    args_mmc=run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype} consoleblank=0 omapdrm.num_crtc=2 drm.debug=0xff
    baudrate=115200
    board=dra7xx
    board_name=dra7xx
    boot_fdt=try
    boot_fit=0
    boot_os=0
    bootargs=androidboot.serialno=${serial#} console=ttyS0,115200 androidboot.console=ttyS0 androidboot.hardware=jacinto6evmboard
    bootcmd=switch_dtb;setenv mmcdev 1; setenv bootpart 1:2; setenv mmcroot /dev/mmcblk0p2 rw; run mmcboot;
    bootdelay=2
    bootdir=/boot
    bootenvfile=uEnv.txt
    bootfile=zImage
    bootm_size=0x10000000
    bootpart=0:2
    bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr}
    console=ttyO2,115200n8
    cpu=armv7
    dfu_alt_info_emmc=rawemmc raw 0 3751936;boot part 1 1;rootfs part 1 2;MLO fat 1 1;MLO.raw raw 0x100 0x100;u-boot.img.raw raw 0x300 0x400;spl-os-args.raw raw 0x80 0x80;spl-os-image.raw raw 0x900 0x2000;spl-os-args fat 1 1;spl-os-image fat 1 1;u-boot.img fat 1 1;uEnv.txt fat 1 1
    dfu_alt_info_mmc=boot part 0 1;rootfs part 0 2;MLO fat 0 1;MLO.raw raw 0x100 0x100;u-boot.img.raw raw 0x300 0x400;spl-os-args.raw raw 0x80 0x80;spl-os-image.raw raw 0x900 0x2000;spl-os-args fat 0 1;spl-os-image fat 0 1;u-boot.img fat 0 1;uEnv.txt fat 0 1
    dfu_alt_info_qspi=MLO raw 0x0 0x040000;u-boot.img raw 0x040000 0x0100000;u-boot-spl-os raw 0x140000 0x080000;u-boot-env raw 0x1C0000 0x010000;u-boot-env.backup raw 0x1D0000 0x010000;kernel raw 0x1E0000 0x800000
    dfu_alt_info_ram=kernel ram 0x80200000 0x4000000;fdt ram 0x80f80000 0x80000;ramdisk ram 0x81000000 0x4000000
    dfu_bufsiz=0x10000
    dofastboot=0
    emmc_android_boot=setenv eval_bootargs setenv bootargs $bootargs; run eval_bootargs; setenv mmcdev 1; setenv fdt_part 3; setenv boot_part 9; if test $reboot_image = recovery; then setenv boot_part 8; setenv reboot_image boot; saveenv; fi;setenv machid fe6; mmc dev $mmcdev; mmc rescan; part start mmc ${mmcdev} ${fdt_part} fdt_start; part size mmc ${mmcdev} ${fdt_part} fdt_size; part start mmc ${mmcdev} ${boot_part} boot_start; part size mmc ${mmcdev} ${boot_part} boot_size; mmc read ${fdtaddr} ${fdt_start} ${fdt_size}; mmc read ${loadaddr} ${boot_start} ${boot_size}; echo Booting from eMMC ...; bootm $loadaddr $loadaddr $fdtaddr;
    envboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadbootscript; then run bootscript;else if run loadbootenv; then echo Loaded env from ${bootenvfile};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;fi;fi;
    eth1addr=a4:d5:78:d6:a4:73
    ethact=cpsw
    ethaddr=a4:d5:78:d6:a4:72
    fastboot.board_rev=unknown
    fastboot.cpu=J6
    fastboot.secure=GP
    fastboot.userdata_size=unknown
    fdt_addr_r=0x88000000
    fdtaddr=0x88000000
    fdtfile=undefined
    findfdt=if test $board_name = omap5_uevm; then setenv fdtfile omap5-uevm.dtb; fi; if test $board_name = dra7xx; then setenv fdtfile dra7-evm.dtb; fi;if test $board_name = dra72x-revc; then setenv fdtfile dra72-evm-revc.dtb; fi;if test $board_name = dra72x; then setenv fdtfile dra72-evm.dtb; fi;if test $board_name = dra71x; then setenv fdtfile dra71-evm.dtb; fi;if test $board_name = beagle_x15; then setenv fdtfile am57xx-beagle-x15.dtb; fi;if test $board_name = beagle_x15_revb1; then setenv fdtfile am57xx-beagle-x15-revb1.dtb; fi;if test $board_name = am57xx_evm; then setenv fdtfile am57xx-evm.dtb; fi;if test $board_name = am57xx_evm_reva3; then setenv fdtfile am57xx-evm-reva3.dtb; fi;if test $board_name = am572x_idk && test $idk_lcd = no; then setenv fdtfile am572x-idk.dtb; fi;if test $board_name = am572x_idk && test $idk_lcd = osd101t2045; then setenv fdtfile am572x-idk-lcd-osd.dtb; fi;if test $board_name = am572x_idk && test $idk_lcd = osd101t2587; then setenv fdtfile am572x-idk-lcd-osd101t2587.dtb; fi;if test $board_name = am571x_idk && test $idk_lcd = no; then setenv fdtfile am571x-idk.dtb; fi;if test $board_name = am571x_idk && test $idk_lcd = osd101t2045; then setenv fdtfile am571x-idk-lcd-osd.dtb; fi;if test $board_name = am571x_idk && test $idk_lcd = osd101t2587; then setenv fdtfile am571x-idk-lcd-osd101t2587.dtb; fi;if test $fdtfile = undefined; then echo WARNING: Could not determine device tree to use; fi;
    finduuid=part uuid mmc ${bootpart} uuid
    fit_bootfile=fitImage.itb
    fit_loadaddr=0x88000000
    importbootenv=echo Importing environment from mmc${mmcdev} ...; env import -t ${loadaddr} ${filesize}
    kernel_addr_r=0x82000000
    loadaddr=0x82000000
    loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
    loadbootscript=fatload mmc ${mmcdev} ${loadaddr} boot.scr
    loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
    loadfit=run args_fit; bootm ${loadaddr}#${fdtfile};
    loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
    mmcboot=if mmc dev ${mmcdev}; then setenv devtype mmc; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadimage; then run loadfdt; echo Booting from mmc${mmcdev} ...; run args_mmc; bootz ${loadaddr} - ${fdtaddr}; fi; fi; fi;
    mmcdev=0
    mmcloados=run args_mmc; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdtaddr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
    mmcrootfstype=ext4 rootwait
    netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
    netboot=echo Booting from network ...; setenv autoload no; dhcp; run netloadimage; run netloadfdt; run netargs; bootz ${loadaddr} - ${fdtaddr}
    netloadfdt=tftp ${fdtaddr} ${fdtfile}
    netloadimage=tftp ${loadaddr} ${bootfile}
    nfsopts=nolock
    partitions=uuid_disk=${uuid_gpt_disk};name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}
    partitions_android=uuid_disk=${uuid_gpt_disk};name=xloader,start=128K,size=128K,uuid=${uuid_gpt_xloader};name=bootloader,size=768K,uuid=${uuid_gpt_bootloader};name=environment,size=128K,uuid=${uuid_gpt_environment};name=misc,size=128K,uuid=${uuid_gpt_misc};name=reserved,size=384K,uuid=${uuid_gpt_reserved};name=efs,size=16M,uuid=${uuid_gpt_efs};name=crypto,size=16K,uuid=${uuid_gpt_crypto};name=recovery,size=10M,uuid=${uuid_gpt_recovery};name=boot,size=10M,uuid=${uuid_gpt_boot};name=system,size=768M,uuid=${uuid_gpt_system};name=cache,size=256M,uuid=${uuid_gpt_cache};name=ipu1,size=8M,uuid=${uuid_gpt_ipu1};name=ipu2,size=8M,uuid=${uuid_gpt_ipu2};name=dsp1,size=8M,uuid=${uuid_gpt_dsp1};name=dsp2,size=8M,uuid=${uuid_gpt_dsp2};name=userdata,size=-,uuid=${uuid_gpt_userdata}
    pxefile_addr_r=0x80100000
    ramdisk_addr_r=0x88080000
    rdaddr=0x88080000
    reboot_image=boot
    rootpath=/export/rootfs
    scriptaddr=0x80000000
    serial#=190110053f800002
    soc=omap5
    static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
    stderr=serial
    stdin=serial
    stdout=serial
    update_to_fit=setenv loadaddr ${fit_loadaddr}; setenv bootfile ${fit_bootfile}
    usbtty=cdc_acm
    vendor=ti
    ver=U-Boot 2016.05 (Mar 08 2018 - 15:06:48 +0800)
    vram=16M

    Environment size: 7106/131067 bytes


    machid:0 r2:2147483904


    Best Regards
    Kevin
  • Hi Kevin,

    Thanks, I'm trying to create a ramdisk and replicate your use-case at my end. I shall provide the inputs soon.

    Regards
    Shravan
  • Hi Kevin,

    Summarizing the steps to load kernel and ramdisk to RAM using fastboot:

    1. While building kernel ensure that "RAM block device support" configuration is enabled, and build the kernel.

    2. After the kernel is built, ensure that the dtb is appended to zImage, by running the below command.

            cat <path to zImage> <path to dtb> > zImage_dtb

    3. Using the boot.img by running the below command

           mkbootimg --kernel zImage_dtb --ramdisk <path_to_you_ramdisk> --base 0x80000000 --kernel_offset 0x00300000 --ramdisk_offset 0x03000000 --tags_offset 0x01000000 -o boot.img

    This creates a boot_image with the following parameters (these are the default values in u-boot):

    a) It loads the kernel to the address 0x80300000 

    b) It sets the address to find the DT at 0x81000000 

    c) Sets the load-address of the ramdisk to 0x83000000 

    4. Boot your board and run the below commands:

             target: fastboot 0

            PC: sudo fastboot -b 0x80000000 boot boot.img

    You should see the kernel boot and jump to the prompt (file-system).

    Regards
    Shravan

  • Hi Shravan,

    Thanks for your reply.

    I have tried the step you provide, but still the same result.
    Booting kernel..
    ## Booting Android Image at 0x82000000 ...
    Kernel load addr 0x80300000 size 4290 KiB
    RAM disk load addr 0x83000000 size 1774 KiB
    Loading Kernel Image ... OK

    Starting kernel ...

    I have following questions to make sure my setting is correct.
    1. How to make sure DT is load to 0x81000000
    2. Where I can found kernel load setting in /u-boot


    Best Regards
    Kevin
  • Hi Kevin,

    Can you modify the fastboot command to the one below? 

    sudo fastboot -b 0x80000000 -c "root=/dev/ram0 rw console=ttyO0,115200n8 initrd=0x83000000,20M ramdisk_size=20480 earlyprintk" boot boot.img

    This should give us a few more logs.

    Can you load to your boot partition of the SD-card with the below files to ensure that an SD boot works? Below are the contents of the SD-card:

    1. MLO

    2. U-boot.img

    3. RAMDISK

    4. zImage (without DTB appended)

    5. DTB

    Once you enter u-boot run the below commands, and see if kernel boots. 

    >setenv bootargs root=/dev/ram0 rw console=ttyO0,115200n8 initrd=0x81600000,20M ramdisk_size=20480 earlyprintk

    >setenv bootcmd 'mmc dev 0; fatload mmc 0 80300000 zImage; fatload mmc 0 81600000 bb.raw; fatload mmc 0 0x81000000 dra7-evm.dtb; bootz 80300000 - 81000000'

    >boot


    Regards

    Shravan

  • Hi Shravan,

    Thanks for your reply.

    I have tried follow your step and log as follow.
    => setenv bootargs root=/dev/ram0 rw console=ttyO0,115200n8 initrd=0x81600000,20M ramdisk_size=20480 earlyprintk
    => setenv bootcmd 'mmc dev 0; fatload mmc 0 80300000 zImage; fatload mmc 0 81600000 bb.raw; fatload mmc 0 0x81000000 dra7-evm-lcd10.dtb; bootz 80300000 - 81000000'
    => boot
    switch to partitions #0, OK
    mmc0 is current device
    reading zImage
    ** Unable to read file zImage **
    reading bb.raw
    ** Unable to read file bb.raw **
    reading dra7-evm-lcd10.dtb
    ** Unable to read file dra7-evm-lcd10.dtb **
    83aceb7e
    Bad Linux ARM zImage magic!
    =>

    But when I only set fdtfile file and it can boot into kernel

    => setenv fdtfile dra7-evm-lcd10.dtb
    => run mmcboot
    switch to partitions #0, OK
    mmc0 is current device
    SD/MMC found on device 0
    4285584 bytes read in 1415 ms (2.9 MiB/s)
    113664 bytes read in 59 ms (1.8 MiB/s)
    Booting from mmc0 ...
    Kernel image @ 0x82000000 [ 0x000000 - 0x416490 ]

    ## Flattened Device Tree blob at 88000000
    Booting using the fdt blob at 0x88000000
    of_flat_tree at 0x88000000 size 0x0001bc00
    Loading Device Tree to 8ffe1000, end 8ffffbff ... OK

    Starting kernel ...

    [ 0.000000] Booting Linux on physical CPU 0x0
    [ 0.000000] Initializing cgroup subsys cpuset
    [ 0.000000] Initializing cgroup subsys cpu
    [ 0.000000] Initializing cgroup subsys cpuacct


    In what file I can check partition setting?
    Or there has some things I should do?

    Best Regards
    Kevin
  • Hi Kevin,

    Can you please let me know the files present in the boot partition of you SD card (where the MLO and u-boot.img is present). The error 'unable to read zImage/dra7-evm-lcd.dtb/bb.raw' indicates to me these files aren't present in the boot partition (FAT partition) of the SD card.

    Also just to clarify, bb.raw is the Ramdisk file. 


    Regards

    Shravan

  • Hi Shravan,

    Thanks for your prompt reply.

    MLO and u-boot.img are in /boot
    zImage and dts are in /rootfs/boot

    Best Regards
    Kevin
  • Hi Kevin,

    As indicated in the previous steps, can you copy zImage, dtb and the ramdisk to the boot partition (i.e /boot, same place as MLO) and try the commands suggested. Pasting the instructions below again.

    Can you load to your boot partition of the SD-card with the below files to ensure that an SD boot works? Below are the contents of the SD-card:

    1. MLO

    2. U-boot.img

    3. RAMDISK (named as bb.raw in subsequent commands).

    4. zImage (without DTB appended)

    5. DTB (named as dra7-evm.dtb in subsequent commands).

    Once you enter u-boot run the below commands, and see if kernel boots.

    >setenv bootargs root=/dev/ram0 rw console=ttyO0,115200n8 initrd=0x81600000,20M ramdisk_size=20480 earlyprintk

    >setenv bootcmd 'mmc dev 0; fatload mmc 0 80300000 zImage; fatload mmc 0 81600000 bb.raw; fatload mmc 0 0x81000000 dra7-evm.dtb; bootz 80300000 - 81000000'

    >boot


    Regards
    Shravan
  • Hi Shravan,

    Thanks for your reply.

    Log as follow.
    => setenv bootargs root=/dev/ram0 rw console=ttyO0,115200n8 initrd=0x81600000,20M ramdisk_size=20480 earlyprintk
    => setenv bootcmd 'mmc dev 0; fatload mmc 0 80300000 zImage; fatload mmc 0 81600000 bb.raw; fatload mmc 0 0x81000000 dra7-evm-lcd10.dtb; bootz 80300000 - 81000000'
    => boot
    switch to partitions #0, OK
    mmc0 is current device
    reading zImage
    4285584 bytes read in 1415 ms (2.9 MiB/s)
    reading bb.raw
    70322 bytes read in 39 ms (1.7 MiB/s)
    reading dra7-evm-lcd10.dtb
    113664 bytes read in 55 ms (2 MiB/s)
    Kernel image @ 0x80300000 [ 0x000000 - 0x416490 ]

    ## Flattened Device Tree blob at 81000000
    Booting using the fdt blob at 0x81000000
    of_flat_tree at 0x81000000 size 0x0001bc00
    Loading Device Tree to 8ffe1000, end 8ffffbff ... OK

    Starting kernel ...


    It fail to boot into kernel when all put in /boot.
    Is that means I need to turn off some config or create /rootfs file?

    Best Regards
    Kevin
  • Hi Kevin,

    I noticed there are quite a few changes between the u-boot environment being used and that of the Processor SDK release. Can you please revert any patches you have on u-boot and restore the MLO and u-boot.img to that of the release? I verified fastboot load and mmc fatload of the ramdisk and kernel to RAM and both work.

    Regards

    Shravan

  • Hi Shravan,

    Thanks for your reply

    I have tried following command and it can boot into kernel now, although I'm not yet to dig out why need to do "run mmcboot" prior "boot".

    => setenv bootargs root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 earlyprintk
    => setenv bootcmd 'mmc dev 0; fatload mmc 0 80300000 zImage; fatload mmc 0 0x81000000 dra7-evm-lcd10.dtb; bootz 80300000 - 81000000'
    => run mmcboot
    switch to partitions #0, OK
    mmc0 is current device
    SD/MMC found on device 0
    4285584 bytes read in 1414 ms (2.9 MiB/s)
    ** File not found /boot/undefined **
    Booting from mmc0 ...
    Kernel image @ 0x82000000 [ 0x000000 - 0x416490 ]
    1
    ERROR: Did not find a cmdline Flattened Device Tree
    Could not find a valid device tree
    => boot
    switch to partitions #0, OK
    mmc0 is current device
    reading zImage
    4285272 bytes read in 1418 ms (2.9 MiB/s)
    reading dra7-evm-lcd10.dtb
    113664 bytes read in 58 ms (1.9 MiB/s)
    Kernel image @ 0x80300000 [ 0x000000 - 0x416358 ]

    ## Flattened Device Tree blob at 81000000
    Booting using the fdt blob at 0x81000000
    of_flat_tree at 0x81000000 size 0x0001bc00
    Loading Device Tree to 8ffe1000, end 8ffffbff ... OK

    Starting kernel ...

    [ 0.000000] Booting Linux on physical CPU 0x0
    [ 0.000000] Initializing cgroup subsys cpuset
    [ 0.000000] Initializing cgroup subsys cpu
    [ 0.000000] Initializing cgroup subsys cpuacct


    But when I try fastboot to boot up and it still fail.
    And I found out that is not load fdt when boot kernel.

    When it run in boot_get_fdt -> genimg_has_config(images) of common/image-fdt.c, genimg_has_config function return false and "ok_no_fdt" is true and it junp out.
    How should I do (make image process or ...) that can let genimg_has_config function return true? Or there has other method to boot up?

    Best Regards
    Kevin
  • Hi Kevin,
    When you're using fastboot, your device-tree needs to be appended to the zImage, as mentioned in the previous post append the device-tree to your zImage by running the following command.

    cat <path to zImage> <path to dtb> > zImage_dtb

    Copy zImage_dtb to your boot partition (rename it to zImage when copying to boot partition).

    Can you please check your pin-settings on your EVM to ensure its in production SD boot mode?
    SW2 [1:8]: 0000 1100
    SW3 [1:8]: 1000 0001

    Is your uboot.img and MLO based on the Processor SDK release?

    Regards
    Shravan
  • Hi Shravan,

    Thanks for your reply

    After I check my setting and found that I send following command can boot up kernel through SD.
    =>setenv bootargs root=/dev/ram0 rw console=ttyO2,115200n8 initrd=0x81600000,20M ramdisk_size=20480 earlyprintk
    =>setenv bootcmd 'mmc dev 0; fatload mmc 0 80300000 zImage; fatload mmc 0 0x81000000 dra7-evm-lcd10.dtb; bootz 80300000 - 81000000'
    =>run args_mmc
    =>boot

    And I think it means mmc fatload load process is ok for me through SD.

    But when I try fastboot load through PC and it still fail.
    I traced it boot up process but cant found where it load fdt.
    Could you give me an advice where fastboot boot porcess load fdt in /u-boot? Or load process is same as mmc fatload?


    Best Regards
    Kevin
  • Hi Kevin,

    Good to know fatload seems to work. For fastboot you need to append the dtb to the zImage are you doing this?

    Regards

    Shravan

  • Hi Shravan,

    Yes, follow the step you provide "cat <path to zImage> <path to dtb> > zImage_dtb "

    Best Regards
    Kevin
  • Hi Kevin,

    Did you use the below command to create boot.img

    mkbootimg --kernel zImage_dtb --ramdisk <path_to_you_ramdisk> --base 0x80000000 --kernel_offset 0x00300000 --ramdisk_offset 0x03000000 --tags_offset 0x01000000 -o boot.img

    Once you boot your board, run the below commands on your target

    u-boot# run args_mmc
    u-boot# fastboot 0

    Then from the PC run the below command
    PC# sudo fastboot -b 0x80000000 boot boot.img

    Can you see if this works?

    Regards
    Shravan
  • Hi Shravan,

    Thanks, it can boot into kernel now.
    Key point is run args_mmc I think.
    But when run to ramdisk, it will kernel panic.
    Could you tell me how you make your ramdisk, or is there has any doc I can reference?

    [ 3.733474] Expected PARTUUID=<valid-uuid-id>[/PARTNROFF=%d]
    [ 3.742946] Disabling rootwait; root= is invalid.
    [ 3.747781] RAMDISK: gzip image found at block 0
    [ 3.781030] RAMDISK: incomplete write (18681 != 32768)
    [ 3.786193] write error
    [ 3.788794] VFS: Cannot open root device "PARTUUID=" or unknown-block(0,0): error -6
    [ 3.796570] Please append a correct "root=" boot option; here are the available partitions:
    [ 3.806927] 0100 4096 ram0 (driver?)
    [ 3.811588] 0101 4096 ram1 (driver?)
    [ 3.816242] 0102 4096 ram2 (driver?)
    [ 3.820965] 0103 4096 ram3 (driver?)
    [ 3.825615] 0104 4096 ram4 (driver?)
    [ 3.830321] 0105 4096 ram5 (driver?)
    [ 3.834967] 0106 4096 ram6 (driver?)
    [ 3.839652] 0107 4096 ram7 (driver?)
    [ 3.844297] 0108 4096 ram8 (driver?)
    [ 3.848978] 0109 4096 ram9 (driver?)
    [ 3.853623] 010a 4096 ram10 (driver?)
    [ 3.858391] 010b 4096 ram11 (driver?)
    [ 3.863129] 010c 4096 ram12 (driver?)
    [ 3.867875] 010d 4096 ram13 (driver?)
    [ 3.872609] 010e 4096 ram14 (driver?)
    [ 3.877358] 010f 4096 ram15 (driver?)
    [ 3.882097] b300 7634944 mmcblk0 driver: mmcblk
    [ 3.887456] b301 63488 mmcblk0p1 593ee62f-01
    [ 3.892799] b302 3757056 mmcblk0p2 593ee62f-02
    [ 3.898164] b320 128 mmcblk0boot1 (driver?)
    [ 3.903507] b310 128 mmcblk0boot0 (driver?)
    [ 3.908863] b330 3821568 mmcblk1 driver: mmcblk
    [ 3.914207] b331 3821567 mmcblk1p1 78af756b-01
    [ 3.919563] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
    [ 3.927870] CPU1: stopping
    [ 3.930595] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.4.45 #28
    [ 3.936626] Hardware name: Generic DRA74X (Flattened Device Tree)
    [ 3.942743] Backtrace:
    [ 3.945221] [<c00131b0>] (dump_backtrace) from [<c001334c>] (show_stack+0x18/0x1c)
    [ 3.952820] r6:00000000 r5:00000000 r4:20000193 r3:00000000
    [ 3.958544] [<c0013334>] (show_stack) from [<c02a7bac>] (dump_stack+0x88/0xa8)
    [ 3.965802] [<c02a7b24>] (dump_stack) from [<c0016414>] (handle_IPI+0x170/0x19c)
    [ 3.973227] r5:c0c39404 r4:00000001
    [ 3.976835] [<c00162a4>] (handle_IPI) from [<c00094e4>] (gic_handle_irq+0x74/0x7c)
    [ 3.984432] r7:fa212000 r6:ee8b9f58 r5:c0c408cc r4:fa21200c
    [ 3.990148] [<c0009470>] (gic_handle_irq) from [<c0013e94>] (__irq_svc+0x54/0x90)
    [ 3.997660] Exception stack(0xee8b9f58 to 0xee8b9fa0)
    [ 4.002731] 9f40: 00000001 00000000
    [ 4.010946] 9f60: 00000000 fe600000 c0c404a4 00000000 00000000 c0c3b560 c0c4050c c0c40504
    [ 4.019160] 9f80: c0c38364 ee8b9fb4 ee8b9f94 ee8b9fa8 c0027f20 c0010944 60000013 ffffffff
    [ 4.027370] r8:c0c4050c r7:ee8b9f8c r6:ffffffff r5:60000013 r4:c0010944 r3:c0027f20
    [ 4.035195] [<c0010920>] (arch_cpu_idle) from [<c006f3c4>] (default_idle_call+0x28/0x34)
    [ 4.043324] [<c006f39c>] (default_idle_call) from [<c006f5f8>] (cpu_startup_entry+0x1d0/0x250)
    [ 4.051975] [<c006f428>] (cpu_startup_entry) from [<c0016034>] (secondary_start_kernel+0x134/0x150)
    [ 4.061056] r7:c0d072b0 r3:ee8b8000
    [ 4.064664] [<c0015f00>] (secondary_start_kernel) from [<8000958c>] (0x8000958c)
    [ 4.072088] r5:00000051 r4:ae89c06a
    [ 4.075699] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
    [ 127.246632] random: nonblocking pool is initialized

    Best Regards
    Kevin
  • Hi Kevin,

    Please find the below steps to create the ramdisk on the PC. Note the name of the ramdisk in the below steps is test.

    PC# dd if=/dev/zero of=test bs=1M count=20 #(this creates an empty file of size 20MB)

    PC# mkfs.ext2 test

    PC# mkdir /tmp/dir   #(create an empty directory dir)

    PC#  sudo mount -o loop test /tmp/dir/   #(Mount the image)

     

    copy all the contents you need into /tmp/dir. This will be the contents of the ramdisk. Once completed, unmount using the below command.

    PC# sudo umount /tmp/dir

    If your ramdisk is greater than 4MB (in this case its 20MB), append the following to your bootargs in u-boot (please make sure you append and not replace the bootargs):

    u-boot# run args_mmc

    u-boot# pr bootargs

    < existing bootargs>

    u-boot# setenv bootargs <existing bootargs> ramdisk_size=20480

    u-boot# fastboot 0

    Attached a sample ramdisk for your reference.


    Regards

    Shravan

    ramdisk_sample.tar.gz

  • Hi Shravan,

    Thanks for your reply.

    When linux boot up and trying to mount ram disk, it all fail to keep runing.
    And log as follow.

    test
    [ 4.110370] RAMDISK: Loading 20480KiB [1 disk] into ram disk... done.
    [ 4.681802] EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
    [ 4.692352] VFS: Mounted root (ext4 filesystem) on device 1:0.
    [ 4.701686] devtmpfs: mounted
    [ 4.708270] Freeing unused kernel memory: 372K (c0be1000 - c0c3e000)
    [ 4.718003] This architecture does not have kernel memory protection.
    [ 4.728206] Kernel panic - not syncing: Requested init linuxrc failed (error -2).

    bb.raw
    [ 4.128555] RAMDISK: ext2 filesystem found at block 0
    [ 4.138253] RAMDISK: Loading 15360KiB [1 disk] into ram disk... done.
    [ 4.560865] EXT4-fs (ram0): warning: mounting unchecked fs, running e2fsck is recommended
    [ 4.572895] EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
    [ 4.583592] VFS: Mounted root (ext4 filesystem) on device 1:0.
    Mounting proc : OK
    Mounting sysfs : OK
    Mounting /dev : OK
    Linux
    Creating local mdev devices
    umount: can't umount /mnt/mmc: Invalid argument

    ******************************************
    Starting System Init for 3430SDP-3430
    Release: LDC0.1
    ******************************************
    Saving kernel ring buffer : OK
    Mounting devpts : OK
    Setting up networking
    Configuring lo : OK
    Configuring eth0 : ifup: can't open '/etc/network/interfaces': No such file or directory
    Failed
    Starting syslogd : OK
    Starting klogd : OK
    Mounting filesystems : OK
    [ 127.558685] random: nonblocking pool is initialized


    Do you have any suggestion that how to modify can mount ramdisk to RAM?

    Best Regards
    Kevin
  • Hi Kevin,



    From your logs I see when bb.raw is used as the ramdisk, the kernel successfully loads the ramdisk.

    You can run e2fsck on the ramdisk to remove any errors in the file-system.

    Can you set your bootargs to that mentioned below and try loading the ramdisk.

    u-boot: setenv bootargs androidboot.serialno=${serial#} console=ttyS0,115200 androidboot.console=ttyS0 androidboot.hardware=jacinto6evmboard ramdisk_size=20480
    Regards

    Shravan