All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: FIT Image boot issue
@ 2017-04-05  4:54 Gujulan Elango, Hari Prasath (H.)
  0 siblings, 0 replies; 3+ messages in thread
From: Gujulan Elango, Hari Prasath (H.) @ 2017-04-05  4:54 UTC (permalink / raw)
  To: yocto
  Cc: Vadivel, Arulpandiyan (A.), Ravindran, Madhusudhanan (M.),
	Rajagopalan, Thiagarajan (T.), DHANAPAL, GNANACHANDRAN (G.)


[-- Attachment #1.1: Type: text/plain, Size: 1525 bytes --]

Sorry the its file was blocked by Outlook. Renamed the extension and re-attaching it.

Regards,
Hari Prasath

From: Gujulan Elango, Hari Prasath (H.)
Sent: Tuesday, April 04, 2017 7:39 PM
To: yocto@yoctoproject.org
Cc: Rajagopalan, Thiagarajan (T.); Vadivel, Arulpandiyan (A.); Ravindran, Madhusudhanan (M.); DHANAPAL, GNANACHANDRAN (G.)
Subject: FIT Image boot issue

Hello all,

We are using FIT image in an ARM 64 bit target based instead of separate Linux binary(Image.bin) and DTB. We are using a copy of the kernel fit image bbclass provided by poky in our custom machine layer to build the fit image. We observe that the bootloader is not able to load the device tree from the RAM. We are using Yocto project 2.1 and kernel version 4.9

Additionally, we observe that the fit image size varies across builds. We are observing two different image sizes viz 6855936 and 6855932 bytes. Of these two, the fit image with size 6855932 bytes boot properly while the image with size 6855936 doesn't boot. Most often the image with 6855932 bytes is generated as build output. Out of 5 to 7 builds (approximately), the image with size 6855936 bytes that causes the boot issue is generated once.

We had modified our custom machine conf file and the kernel-fitimage.bbclass provided by poky layer for adding fit Image support . I have attached the modified fitimage bbclass file,our custom machine layer conf file ,its file generated and the error log during boot for your reference.

Regards,
Hari Prasath


[-- Attachment #1.2: Type: text/html, Size: 4450 bytes --]

[-- Attachment #2: fitImage-its-salvator-x --]
[-- Type: application/octet-stream, Size: 1486 bytes --]

/dts-v1/;

/ {
        description = "U-Boot fitImage for Poky (Yocto Project Reference Distro)/4.9.0+gitAUTOINC+13e7680774/salvator-x";
        #address-cells = <1>;

        images {
                kernel@1 {
                        description = "Linux kernel";
                        data = /incbin/("linux.bin");
                        type = "kernel";
                        arch = "arm64";
                        os = "linux";
                        compression = "gzip";
                        load = <0x48080000>;
                        entry = <0x48080000>;
                        hash@1 {
                                algo = "sha1";
                        };
                };
                fdt@1 {
                        description = "Flattened Device Tree blob";
                        data = /incbin/("arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dtb");
                        type = "flat_dt";
                        arch = "arm64";
                        compression = "none";
                        hash@1 {
                                algo = "sha1";
                        };
                };
	};

        configurations {
                default = "conf@1";
                conf@1 {
                        description = "Boot Linux kernel with FDT blob";
			kernel = "kernel@1";
			fdt = "fdt@1";
                        hash@1 {
                                algo = "sha1";
                        };
                };
	};
};

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FIT Image boot issue
  2017-04-04 14:08 Gujulan Elango, Hari Prasath (H.)
@ 2017-04-05  9:07 ` Fabien Lahoudere
  0 siblings, 0 replies; 3+ messages in thread
From: Fabien Lahoudere @ 2017-04-05  9:07 UTC (permalink / raw)
  To: yocto

Hi,

Did you try if it works out of yocto?

I use those lines to generate FitImage from a kernel tree:

source ../poky/build/tmp/environment-setup-cortexa8hf-neon-helix-linux-gnueabi
make ARCH=arm CROSS_COMPILE=arm-helix-linux-gnueabi- -j16 zImage ???.dtb ???.dtb
arm-helix-linux-gnueabi-objcopy -O binary -R .note -R .comment -S arch/arm/boot/compressed/vmlinux
linux.bin
mkimage -f ???.its fitImage

Fabien

On Tue, 2017-04-04 at 14:08 +0000, Gujulan Elango, Hari Prasath (H.) wrote:
> Hello all,
>  
> We are using FIT image in an ARM 64 bit target based instead of separate Linux binary(Image.bin)
> and DTB. We are using a copy of the kernel fit image bbclass provided by poky in our custom
> machine layer to build the fit image. We observe that the bootloader is not able to load the
> device tree from the RAM. We are using Yocto project 2.1 and kernel version 4.9
>  
> Additionally, we observe that the fit image size varies across builds. We are observing two
> different image sizes viz 6855936 and 6855932 bytes. Of these two, the fit image with size 6855932
> bytes boot properly while the image with size 6855936 doesn't boot. Most often the image with
> 6855932 bytes is generated as build output. Out of 5 to 7 builds (approximately), the image with
> size 6855936 bytes that causes the boot issue is generated once.
>  
> We had modified our custom machine conf file and the kernel-fitimage.bbclass provided by poky
> layer for adding fit Image support . I have attached the modified fitimage bbclass file,our custom
> machine layer conf file ,its file generated and the error log during boot for your reference.
>  
> Regards,
> Hari Prasath
>  


^ permalink raw reply	[flat|nested] 3+ messages in thread

* FIT Image boot issue
@ 2017-04-04 14:08 Gujulan Elango, Hari Prasath (H.)
  2017-04-05  9:07 ` Fabien Lahoudere
  0 siblings, 1 reply; 3+ messages in thread
From: Gujulan Elango, Hari Prasath (H.) @ 2017-04-04 14:08 UTC (permalink / raw)
  To: yocto
  Cc: Vadivel, Arulpandiyan (A.), Ravindran, Madhusudhanan (M.),
	Rajagopalan, Thiagarajan (T.), DHANAPAL, GNANACHANDRAN (G.)


[-- Attachment #1.1: Type: text/plain, Size: 1145 bytes --]

Hello all,

We are using FIT image in an ARM 64 bit target based instead of separate Linux binary(Image.bin) and DTB. We are using a copy of the kernel fit image bbclass provided by poky in our custom machine layer to build the fit image. We observe that the bootloader is not able to load the device tree from the RAM. We are using Yocto project 2.1 and kernel version 4.9

Additionally, we observe that the fit image size varies across builds. We are observing two different image sizes viz 6855936 and 6855932 bytes. Of these two, the fit image with size 6855932 bytes boot properly while the image with size 6855936 doesn't boot. Most often the image with 6855932 bytes is generated as build output. Out of 5 to 7 builds (approximately), the image with size 6855936 bytes that causes the boot issue is generated once.

We had modified our custom machine conf file and the kernel-fitimage.bbclass provided by poky layer for adding fit Image support . I have attached the modified fitimage bbclass file,our custom machine layer conf file ,its file generated and the error log during boot for your reference.

Regards,
Hari Prasath


[-- Attachment #1.2: Type: text/html, Size: 3114 bytes --]

[-- Attachment #2: fit-image-error.log --]
[-- Type: application/octet-stream, Size: 3680 bytes --]

NOTICE:  BL2: PRR is R-Car H3 ES1.1
NOTICE:  BL2: LCM state is CM
NOTICE:  BL2: DDR2400(rev.0.15)
NOTICE:  BL2: DRAM Split is 4ch
NOTICE:  BL2: QoS is Gfx Oriented(rev.0.30)
NOTICE:  BL2: AVS setting succeeded. DVFS_SetVID=0x52
NOTICE:  BL2: Lossy Decomp areas
NOTICE:       Entry 0: DCMPAREACRAx:0x80000540 DCMPAREACRBx:0x570
NOTICE:       Entry 1: DCMPAREACRAx:0x40000000 DCMPAREACRBx:0x0
NOTICE:       Entry 2: DCMPAREACRAx:0x20000000 DCMPAREACRBx:0x0
NOTICE:  BL2: v1.1(release):41099f4
NOTICE:  BL2: Built : 10:52:38, Feb 28 2017
NOTICE:  BL2: Normal boot
NOTICE:  BL2: dst=0xe63150c8 src=0x8180000 len=36(0x24)
NOTICE:  BL2: dst=0x43f00000 src=0x8180400 len=3072(0xc00)
NOTICE:  BL2: dst=0x44000000 src=0x81c0000 len=65536(0x10000)
NOTICE:  BL2: dst=0x44100000 src=0x8200000 len=524288(0x80000)
NOTICE:  BL2: dst=0x49000000 src=0x8640000 len=1048576(0x100000)


U-Boot 2015.04 (Feb 28 2017 - 10:57:37)

CPU: Renesas Electronics R8A7795 rev 1.1
Board: Salvator-X
I2C:   ready
DRAM:  3.9 GiB
MMC:   sh-sdhi: 0, sh-sdhi: 1, sh-sdhi: 2
In:    serial
Out:   serial
Err:   serial
Net:   Board Net Initialization Failed
No ethernet found.
Hit any key to stop autoboot:  0 
=> setenv bootargs 'console=ttySC0,115200 root=/dev/sda2 rw rootwait rootfstype=ext4 relative_sleep_states=1 cma=384MB video=HDMI-A-1:1024x76
8R video=HDMI-A-2:1024x768
=> setenv bootcmd 'usb start;fatload usb 0:1 0x4c000000 fitImage-salvator-x-6855936.bin;bootm 0x4c000000'
=> run bootcmd
starting USB...
USB0:   USB EHCI 1.10
scanning bus 0 for devices... 1 USB Device(s) found
USB1:   USB EHCI 1.10
scanning bus 1 for devices... 1 USB Device(s) found
USB2:   USB EHCI 1.10
scanning bus 2 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
reading fitImage-salvator-x-6855936.bin
6855936 bytes read in 321 ms (20.4 MiB/s)
## Loading kernel from FIT Image at 4c000000 ...
   Using 'conf@1' configuration
   Trying 'kernel@1' kernel subimage
     Description:  Linux kernel
     Type:         Kernel Image
     Compression:  gzip compressed
     Data Start:   0x4c000114
     Data Size:    6785798 Bytes = 6.5 MiB
     Architecture: AArch64
     OS:           Linux
     Load Address: 0x48080000
     Entry Point:  0x48080000
     Hash algo:    sha1
     Hash value:   a29a4a8267f350f8c218f51463c0df5e87100fe0
   Verifying Hash Integrity ... sha1+ OK
## Loading fdt from FIT Image at 4c000000 ...
   Using 'conf@1' configuration
   Trying 'fdt@1' fdt subimage
     Description:  Flattened Device Tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x4c678d14
     Data Size:    68771 Bytes = 67.2 KiB
     Architecture: AArch64
     Hash algo:    sha1
     Hash value:   ee208b765df4a541fb4ef4f886f573821764bb66
   Verifying Hash Integrity ... sha1+ OK
   Booting using the fdt blob at 0x4c678d14
   Uncompressing Kernel Image ... OK
"Synchronous Abort" handler, esr 0x96000021
ELR:     49029264
LR:      49010f18
x0 : 0000000000000000 x1 : 000000004c678d44
x2 : 0000000000000011 x3 : 0000000000000009
x4 : 0000000000000000 x5 : 0000000049038730
x6 : 0000000000000002 x7 : 0000000049051d98
x8 : 0000000000000000 x9 : 00000000ffffffff
x10: 0000000048f7fa00 x11: 0000000000000001
x12: 0000000000000060 x13: 00000000000001ff
x14: 000000000000003f x15: 000000007fe6a600
x16: 000000007fe6b038 x17: 0000000100000000
x18: 000000007fe63e20 x19: 0000000000000000
x20: 000000004c678d14 x21: 000000004903ddc6
x22: 0000000049051b98 x23: 0000000049051cd8
x24: 0000000000000000 x25: 0000000049048930
x26: 000000004c000114 x27: 00000000490018a0
x28: 0000000048080000 x29: 000000007fe63580

Resetting CPU ...

resetting ...

[-- Attachment #3: fitImage-its-salvator-x.its --]
[-- Type: application/octet-stream, Size: 1486 bytes --]

/dts-v1/;

/ {
        description = "U-Boot fitImage for Poky (Yocto Project Reference Distro)/4.9.0+gitAUTOINC+13e7680774/salvator-x";
        #address-cells = <1>;

        images {
                kernel@1 {
                        description = "Linux kernel";
                        data = /incbin/("linux.bin");
                        type = "kernel";
                        arch = "arm64";
                        os = "linux";
                        compression = "gzip";
                        load = <0x48080000>;
                        entry = <0x48080000>;
                        hash@1 {
                                algo = "sha1";
                        };
                };
                fdt@1 {
                        description = "Flattened Device Tree blob";
                        data = /incbin/("arch/arm64/boot/dts/renesas/r8a7795-es1-salvator-x.dtb");
                        type = "flat_dt";
                        arch = "arm64";
                        compression = "none";
                        hash@1 {
                                algo = "sha1";
                        };
                };
	};

        configurations {
                default = "conf@1";
                conf@1 {
                        description = "Boot Linux kernel with FDT blob";
			kernel = "kernel@1";
			fdt = "fdt@1";
                        hash@1 {
                                algo = "sha1";
                        };
                };
	};
};

[-- Attachment #4: kernel-fitimage.bbclass --]
[-- Type: application/octet-stream, Size: 5932 bytes --]

inherit kernel-uboot

python __anonymous () {
    kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
    if kerneltype == 'fitImage':
        depends = d.getVar("DEPENDS", True)
        depends = "%s u-boot-mkimage-native dtc-native" % depends
        d.setVar("DEPENDS", depends)

	# Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal
	# to kernel.bbclass . We have to override it, since we pack Image
	# (at least for now) into the fitImage .
        d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "Image")

        image = d.getVar('INITRAMFS_IMAGE', True)
        if image:
            d.appendVarFlag('do_assemble_fitimage', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
}

#
# Emit the fitImage ITS header
#
fitimage_emit_fit_header() {
	cat << EOF >> fit-image.its
/dts-v1/;

/ {
        description = "U-Boot fitImage for ${DISTRO_NAME}/${PV}/${MACHINE}";
        #address-cells = <1>;
EOF
}

#
# Emit the fitImage section bits
#
# $1 ... Section bit type: imagestart - image section start
#                          confstart  - configuration section start
#                          sectend    - section end
#                          fitend     - fitimage end
#
fitimage_emit_section_maint() {
	case $1 in
	imagestart)
		cat << EOF >> fit-image.its

        images {
EOF
	;;
	confstart)
		cat << EOF >> fit-image.its

        configurations {
EOF
	;;
	sectend)
		cat << EOF >> fit-image.its
	};
EOF
	;;
	fitend)
		cat << EOF >> fit-image.its
};
EOF
	;;
	esac
}

#
# Emit the fitImage ITS kernel section
#
# $1 ... Image counter
# $2 ... Path to kernel image
# $3 ... Compression type
fitimage_emit_section_kernel() {

	kernel_csum="sha1"

	ENTRYPOINT=${UBOOT_ENTRYPOINT}
	if test -n "${UBOOT_ENTRYSYMBOL}"; then
		ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \
			awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'`
	fi

	cat << EOF >> fit-image.its
                kernel@${1} {
                        description = "Linux kernel";
                        data = /incbin/("${2}");
                        type = "kernel";
                        arch = "${UBOOT_ARCH}";
                        os = "linux";
                        compression = "${3}";
                        load = <${UBOOT_LOADADDRESS}>;
                        entry = <${ENTRYPOINT}>;
                        hash@1 {
                                algo = "${kernel_csum}";
                        };
                };
EOF
}

#
# Emit the fitImage ITS DTB section
#
# $1 ... Image counter
# $2 ... Path to DTB image
fitimage_emit_section_dtb() {

	dtb_csum="sha1"

	cat << EOF >> fit-image.its
                fdt@${1} {
                        description = "Flattened Device Tree blob";
                        data = /incbin/("${2}");
                        type = "flat_dt";
                        arch = "${UBOOT_ARCH}";
                        compression = "none";
                        hash@1 {
                                algo = "${dtb_csum}";
                        };
                };
EOF
}

#
# Emit the fitImage ITS configuration section
#
# $1 ... Linux kernel ID
# $2 ... DTB image ID
fitimage_emit_section_config() {

	conf_csum="sha1"

	# Test if we have any DTBs at all
	if [ -z "${2}" ] ; then
		conf_desc="Boot Linux kernel"
		fdt_line=""
	else
		conf_desc="Boot Linux kernel with FDT blob"
		fdt_line="fdt = \"fdt@${2}\";"
	fi
	kernel_line="kernel = \"kernel@${1}\";"

	cat << EOF >> fit-image.its
                default = "conf@1";
                conf@1 {
                        description = "${conf_desc}";
			${kernel_line}
			${fdt_line}
                        hash@1 {
                                algo = "${conf_csum}";
                        };
                };
EOF
}

do_assemble_fitimage() {
	if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
		kernelcount=1
		dtbcount=""
		rm -f fit-image.its

		fitimage_emit_fit_header

		#
		# Step 1: Prepare a kernel image section.
		#
		fitimage_emit_section_maint imagestart

		uboot_prep_kimage
		fitimage_emit_section_kernel "${kernelcount}" linux.bin "${linux_comp}"

		#
		# Step 2: Prepare a DTB image section
		#
		if test -n "${KERNEL_DEVICETREE}"; then
			dtbcount=1
			for DTB in ${KERNEL_DEVICETREE}; do
				if echo ${DTB} | grep -q '/dts/'; then
					bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
					DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
				fi
				DTB_PATH="arch/${ARCH}/boot/dts/${DTB}"
				if [ ! -e "${DTB_PATH}" ]; then
					DTB_PATH="arch/${ARCH}/boot/${DTB}"
				fi

				fitimage_emit_section_dtb ${dtbcount} ${DTB_PATH}
				dtbcount=`expr ${dtbcount} + 1`
			done
		fi

		fitimage_emit_section_maint sectend

		# Force the first Kernel and DTB in the default config
		kernelcount=1
		dtbcount=1

		#
		# Step 3: Prepare a configurations section
		#
		fitimage_emit_section_maint confstart

		fitimage_emit_section_config ${kernelcount} ${dtbcount}

		fitimage_emit_section_maint sectend

		fitimage_emit_section_maint fitend

		#
		# Step 4: Assemble the image
		#
		uboot-mkimage -f fit-image.its arch/${ARCH}/boot/fitImage
	fi
}

addtask assemble_fitimage before do_install after do_compile

kernel_do_deploy[vardepsexclude] = "DATETIME"
kernel_do_deploy_append() {
	# Update deploy directory
	if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
		cd ${B}
		echo "Copying fit-image.its source file..."
		its_base_name="${KERNEL_IMAGETYPE}-its-${PV}-${PR}-${MACHINE}-${DATETIME}"
		its_symlink_name=${KERNEL_IMAGETYPE}-its-${MACHINE}
		install -m 0644 fit-image.its ${DEPLOYDIR}/${its_base_name}.its
		linux_bin_base_name="${KERNEL_IMAGETYPE}-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}"
		linux_bin_symlink_name=${KERNEL_IMAGETYPE}-linux.bin-${MACHINE}
		install -m 0644 linux.bin ${DEPLOYDIR}/${linux_bin_base_name}.bin

		cd ${DEPLOYDIR}
		ln -sf ${its_base_name}.its ${its_symlink_name}.its
		ln -sf ${linux_bin_base_name}.bin ${linux_bin_symlink_name}.bin
	fi
}

[-- Attachment #5: salvator-x.conf --]
[-- Type: application/octet-stream, Size: 1380 bytes --]

#@TYPE: Machine
#@NAME: Salvator-X machine
#@DESCRIPTION: Machine configuration for running Salvator-X

DEFAULTTUNE ?= "cortexa57-cortexa53"
require conf/machine/include/tune-cortexa57-cortexa53.inc
require conf/machine/include/${SOC_FAMILY}.inc

# 32BIT package install (default is disable)
# This variables can be used only in multilib.
USE_32BIT_PKGS ?= "0"
USE_32BIT_WAYLAND ?= "0"
USE_32BIT_MMP ?= "0"

MACHINE_FEATURES = ""

KERNEL_CLASSES = "kernel-fitimage"
KERNEL_IMAGETYPE = "fitImage"
#KERNEL_IMAGETYPE = "Image"
UBOOT_ENTRYPOINT = "0x48080000"
ENTRYPOINT = "0x48080000"
IMAGE_FSTYPES = "tar.bz2 ext4 cpio.gz"

SERIAL_CONSOLE = "115200 ttySC0"

# Configuration for kernel
PREFERRED_PROVIDER_virtual/kernel = "linux-renesas"
# Device tree for H3
KERNEL_DEVICETREE_r8a7795 = " \
    renesas/r8a7795-es1-salvator-x.dtb \
"
# Device tree for M3
KERNEL_DEVICETREE_r8a7796 = "renesas/r8a7796-salvator-x.dtb"

# Configuration for ARM Trusted Firmware
EXTRA_IMAGEDEPENDS += " arm-trusted-firmware optee-os"

# u-boot
PREFERRED_VERSION_u-boot = "v2015.04%"
EXTRA_IMAGEDEPENDS += " u-boot"
# H3 u-boot configure
UBOOT_MACHINE_r8a7795 = "r8a7795_salvator-x_defconfig"
# M3 u-boot configure
UBOOT_MACHINE_r8a7796 = "r8a7796_salvator-x_defconfig"

# libdrm
PREFERRED_VERSION_libdrm = "2.4.68"

# Add variable to Build Configuration in build log
BUILDCFG_VARS_append = " SOC_FAMILY"

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-05  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05  4:54 FIT Image boot issue Gujulan Elango, Hari Prasath (H.)
  -- strict thread matches above, loose matches on Subject: below --
2017-04-04 14:08 Gujulan Elango, Hari Prasath (H.)
2017-04-05  9:07 ` Fabien Lahoudere

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.