kernel-fitimage: Fix fpga support in fitimage
Instead of rewriting the full fitimage_assemble, we can just append to the part generating the kernel entry, therefore reducing the duplicated code. BugzID: 74530
This commit is contained in:
parent
29d4398168
commit
c76e078016
|
|
@ -1,5 +1,3 @@
|
|||
inherit kernel
|
||||
|
||||
do_assemble_fitimage[depends] += "fpga-image:do_deploy"
|
||||
|
||||
#
|
||||
|
|
@ -8,12 +6,12 @@ do_assemble_fitimage[depends] += "fpga-image:do_deploy"
|
|||
# $1 ... .its filename
|
||||
# $2 ... Image counter
|
||||
# $3 ... Path to fpga image
|
||||
fitimage_emit_section_fpga() {
|
||||
|
||||
fitimage_emit_section_kernel_append() {
|
||||
fpgacount=1
|
||||
cat << EOF >> ${1}
|
||||
fpga@${2} {
|
||||
fpga@${fpgacount} {
|
||||
description = "FPGA";
|
||||
data = /incbin/("${3}");
|
||||
data = /incbin/("${DEPLOY_DIR_IMAGE}/fpga-image-${MACHINE}");
|
||||
type = "fpga";
|
||||
arch = "${UBOOT_ARCH}";
|
||||
compression = "none";
|
||||
|
|
@ -23,128 +21,3 @@ fitimage_emit_section_fpga() {
|
|||
};
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Assemble fitImage
|
||||
#
|
||||
# $1 ... .its filename
|
||||
# $2 ... fitImage name
|
||||
# $3 ... include ramdisk
|
||||
fitimage_assemble() {
|
||||
kernelcount=1
|
||||
fpgacount=1
|
||||
dtbcount=""
|
||||
DTBS=""
|
||||
ramdiskcount=${3}
|
||||
setupcount=""
|
||||
rm -f ${1} arch/${ARCH}/boot/${2}
|
||||
|
||||
fitimage_emit_fit_header ${1}
|
||||
|
||||
#
|
||||
# Step 1: Prepare a kernel image section.
|
||||
#
|
||||
fitimage_emit_section_maint ${1} imagestart
|
||||
|
||||
uboot_prep_kimage
|
||||
fitimage_emit_section_kernel ${1} "${kernelcount}" linux.bin "${linux_comp}"
|
||||
|
||||
#
|
||||
# Step 1.5: Prepare a fpga image section.
|
||||
#
|
||||
fitimage_emit_section_fpga ${1} "${fpgacount}" "${DEPLOY_DIR_IMAGE}/fpga-image-${MACHINE}"
|
||||
|
||||
#
|
||||
# Step 2: Prepare a DTB image section
|
||||
#
|
||||
if [ -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
|
||||
|
||||
DTB=$(echo "${DTB}" | tr '/' '_')
|
||||
DTBS="${DTBS} ${DTB}"
|
||||
fitimage_emit_section_dtb ${1} ${DTB} ${DTB_PATH}
|
||||
done
|
||||
fi
|
||||
|
||||
#
|
||||
# Step 3: Prepare a setup section. (For x86)
|
||||
#
|
||||
if [ -e arch/${ARCH}/boot/setup.bin ]; then
|
||||
setupcount=1
|
||||
fitimage_emit_section_setup ${1} "${setupcount}" arch/${ARCH}/boot/setup.bin
|
||||
fi
|
||||
|
||||
#
|
||||
# Step 4: Prepare a ramdisk section.
|
||||
#
|
||||
if [ "x${ramdiskcount}" = "x1" ] ; then
|
||||
# Find and use the first initramfs image archive type we find
|
||||
for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.gz ext2.gz cpio; do
|
||||
initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.${img}"
|
||||
echo "Using $initramfs_path"
|
||||
if [ -e "${initramfs_path}" ]; then
|
||||
fitimage_emit_section_ramdisk ${1} "${ramdiskcount}" "${initramfs_path}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
fitimage_emit_section_maint ${1} sectend
|
||||
|
||||
# Force the first Kernel and DTB in the default config
|
||||
kernelcount=1
|
||||
if [ -n "${dtbcount}" ]; then
|
||||
dtbcount=1
|
||||
fi
|
||||
|
||||
#
|
||||
# Step 5: Prepare a configurations section
|
||||
#
|
||||
fitimage_emit_section_maint ${1} confstart
|
||||
|
||||
if [ -n "${DTBS}" ]; then
|
||||
i=1
|
||||
for DTB in ${DTBS}; do
|
||||
dtb_ext=${DTB##*.}
|
||||
if [ "${dtb_ext}" = "dtbo" ]; then
|
||||
fitimage_emit_section_config ${1} "" "${DTB}" "" "" "`expr ${i} = ${dtbcount}`"
|
||||
else
|
||||
fitimage_emit_section_config ${1} "${kernelcount}" "${DTB}" "${ramdiskcount}" "${setupcount}" "`expr ${i} = ${dtbcount}`"
|
||||
fi
|
||||
i=`expr ${i} + 1`
|
||||
done
|
||||
fi
|
||||
|
||||
fitimage_emit_section_maint ${1} sectend
|
||||
|
||||
fitimage_emit_section_maint ${1} fitend
|
||||
|
||||
#
|
||||
# Step 6: Assemble the image
|
||||
#
|
||||
uboot-mkimage \
|
||||
${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
|
||||
-f ${1} \
|
||||
arch/${ARCH}/boot/${2}
|
||||
|
||||
#
|
||||
# Step 7: Sign the image and add public key to U-Boot dtb
|
||||
#
|
||||
if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
|
||||
uboot-mkimage \
|
||||
${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
|
||||
-F -k "${UBOOT_SIGN_KEYDIR}" \
|
||||
${@'-K "${DEPLOY_DIR_IMAGE}/${UBOOT_DTB_BINARY}"' if len('${UBOOT_DTB_BINARY}') else ''} \
|
||||
-r arch/${ARCH}/boot/${2}
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright (C) 2018 NetModule AG
|
||||
|
||||
inherit ${@bb.utils.contains('MACHINE_FEATURES', 'fpga', 'kernel-fitimage-fpga', 'kernel', d)}
|
||||
inherit kernel
|
||||
|
||||
DESCRIPTION = "Linux kernel for various NetModule hardware"
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ LICENSE = "GPLv2"
|
|||
|
||||
|
||||
inherit kernel-fitimage
|
||||
inherit ${@bb.utils.contains('MACHINE_FEATURES', 'fpga', 'kernel-fitimage-fpga', '', d)}
|
||||
inherit kernel-arch
|
||||
inherit deploy
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue