meta-phosphor: retab all bitbake files
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Id89782274717a4fdcabb10df19510cbd05571ec1
diff --git a/meta-phosphor/classes/fit-image.bbclass b/meta-phosphor/classes/fit-image.bbclass
index 227fe47..7d23f44 100644
--- a/meta-phosphor/classes/fit-image.bbclass
+++ b/meta-phosphor/classes/fit-image.bbclass
@@ -68,7 +68,7 @@
#
# $1 ... .its filename
fitimage_emit_fit_header() {
- cat << EOF >> $1
+ cat << EOF >> $1
/dts-v1/;
/ {
@@ -87,30 +87,30 @@
# fitend - fitimage end
#
fitimage_emit_section_maint() {
- case $2 in
- imagestart)
- cat << EOF >> $1
+ case $2 in
+ imagestart)
+ cat << EOF >> $1
images {
EOF
- ;;
- confstart)
- cat << EOF >> $1
+ ;;
+ confstart)
+ cat << EOF >> $1
configurations {
EOF
- ;;
- sectend)
- cat << EOF >> $1
- };
+ ;;
+ sectend)
+ cat << EOF >> $1
+ };
EOF
- ;;
- fitend)
- cat << EOF >> $1
+ ;;
+ fitend)
+ cat << EOF >> $1
};
EOF
- ;;
- esac
+ ;;
+ esac
}
@@ -123,17 +123,17 @@
# $4 ... Compression type
fitimage_emit_section_kernel() {
- kernel_csum="${FIT_HASH_ALG}"
- kernel_sign_algo="${FIT_SIGN_ALG}"
- kernel_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
+ kernel_csum="${FIT_HASH_ALG}"
+ kernel_sign_algo="${FIT_SIGN_ALG}"
+ kernel_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
- ENTRYPOINT="${UBOOT_ENTRYPOINT}"
- if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
- ENTRYPOINT=`${HOST_PREFIX}nm vmlinux | \
- awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
- fi
+ ENTRYPOINT="${UBOOT_ENTRYPOINT}"
+ if [ -n "${UBOOT_ENTRYSYMBOL}" ]; then
+ ENTRYPOINT=`${HOST_PREFIX}nm vmlinux | \
+ awk '$3=="${UBOOT_ENTRYSYMBOL}" {print "0x"$1;exit}'`
+ fi
- cat << EOF >> $1
+ cat << EOF >> $1
kernel-$2 {
description = "Linux kernel";
data = /incbin/("$3");
@@ -149,16 +149,16 @@
};
EOF
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$kernel_sign_keyname" ] ; then
- sed -i '$ d' $1
- cat << EOF >> $1
+ if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$kernel_sign_keyname" ] ; then
+ sed -i '$ d' $1
+ cat << EOF >> $1
signature-1 {
algo = "$kernel_csum,$kernel_sign_algo";
key-name-hint = "$kernel_sign_keyname";
};
};
EOF
- fi
+ fi
}
#
@@ -169,20 +169,20 @@
# $3 ... Path to DTB image
fitimage_emit_section_dtb() {
- dtb_csum="${FIT_HASH_ALG}"
- dtb_sign_algo="${FIT_SIGN_ALG}"
- dtb_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
+ dtb_csum="${FIT_HASH_ALG}"
+ dtb_sign_algo="${FIT_SIGN_ALG}"
+ dtb_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
- dtb_loadline=""
- dtb_ext=${DTB##*.}
- if [ "${dtb_ext}" = "dtbo" ]; then
- if [ -n "${UBOOT_DTBO_LOADADDRESS}" ]; then
- dtb_loadline="load = <${UBOOT_DTBO_LOADADDRESS}>;"
- fi
- elif [ -n "${UBOOT_DTB_LOADADDRESS}" ]; then
- dtb_loadline="load = <${UBOOT_DTB_LOADADDRESS}>;"
- fi
- cat << EOF >> $1
+ dtb_loadline=""
+ dtb_ext=${DTB##*.}
+ if [ "${dtb_ext}" = "dtbo" ]; then
+ if [ -n "${UBOOT_DTBO_LOADADDRESS}" ]; then
+ dtb_loadline="load = <${UBOOT_DTBO_LOADADDRESS}>;"
+ fi
+ elif [ -n "${UBOOT_DTB_LOADADDRESS}" ]; then
+ dtb_loadline="load = <${UBOOT_DTB_LOADADDRESS}>;"
+ fi
+ cat << EOF >> $1
fdt-$2 {
description = "Flattened Device Tree blob";
data = /incbin/("$3");
@@ -196,16 +196,16 @@
};
EOF
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$dtb_sign_keyname" ] ; then
- sed -i '$ d' $1
- cat << EOF >> $1
+ if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$dtb_sign_keyname" ] ; then
+ sed -i '$ d' $1
+ cat << EOF >> $1
signature-1 {
algo = "$dtb_csum,$dtb_sign_algo";
key-name-hint = "$dtb_sign_keyname";
};
};
EOF
- fi
+ fi
}
#
@@ -216,9 +216,9 @@
# $3 ... Path to boot script image
fitimage_emit_section_boot_script() {
- bootscr_csum="${FIT_HASH_ALG}"
- bootscr_sign_algo="${FIT_SIGN_ALG}"
- bootscr_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
+ bootscr_csum="${FIT_HASH_ALG}"
+ bootscr_sign_algo="${FIT_SIGN_ALG}"
+ bootscr_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
cat << EOF >> $1
bootscr-$2 {
@@ -233,16 +233,16 @@
};
EOF
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$bootscr_sign_keyname" ] ; then
- sed -i '$ d' $1
- cat << EOF >> $1
+ if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$bootscr_sign_keyname" ] ; then
+ sed -i '$ d' $1
+ cat << EOF >> $1
signature-1 {
algo = "$bootscr_csum,$bootscr_sign_algo";
key-name-hint = "$bootscr_sign_keyname";
};
};
EOF
- fi
+ fi
}
#
@@ -253,9 +253,9 @@
# $3 ... Path to setup image
fitimage_emit_section_setup() {
- setup_csum="${FIT_HASH_ALG}"
+ setup_csum="${FIT_HASH_ALG}"
- cat << EOF >> $1
+ cat << EOF >> $1
setup-$2 {
description = "Linux setup.bin";
data = /incbin/("$3");
@@ -280,20 +280,20 @@
# $3 ... Path to ramdisk image
fitimage_emit_section_ramdisk() {
- ramdisk_csum="${FIT_HASH_ALG}"
- ramdisk_sign_algo="${FIT_SIGN_ALG}"
- ramdisk_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
- ramdisk_loadline=""
- ramdisk_entryline=""
+ ramdisk_csum="${FIT_HASH_ALG}"
+ ramdisk_sign_algo="${FIT_SIGN_ALG}"
+ ramdisk_sign_keyname="${UBOOT_SIGN_IMG_KEYNAME}"
+ ramdisk_loadline=""
+ ramdisk_entryline=""
- if [ -n "${UBOOT_RD_LOADADDRESS}" ]; then
- ramdisk_loadline="load = <${UBOOT_RD_LOADADDRESS}>;"
- fi
- if [ -n "${UBOOT_RD_ENTRYPOINT}" ]; then
- ramdisk_entryline="entry = <${UBOOT_RD_ENTRYPOINT}>;"
- fi
+ if [ -n "${UBOOT_RD_LOADADDRESS}" ]; then
+ ramdisk_loadline="load = <${UBOOT_RD_LOADADDRESS}>;"
+ fi
+ if [ -n "${UBOOT_RD_ENTRYPOINT}" ]; then
+ ramdisk_entryline="entry = <${UBOOT_RD_ENTRYPOINT}>;"
+ fi
- cat << EOF >> $1
+ cat << EOF >> $1
ramdisk-$2 {
description = "${INITRAMFS_IMAGE}";
data = /incbin/("$3");
@@ -309,16 +309,16 @@
};
EOF
- if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$ramdisk_sign_keyname" ] ; then
- sed -i '$ d' $1
- cat << EOF >> $1
+ if [ "${UBOOT_SIGN_ENABLE}" = "1" -a "${FIT_SIGN_INDIVIDUAL}" = "1" -a -n "$ramdisk_sign_keyname" ] ; then
+ sed -i '$ d' $1
+ cat << EOF >> $1
signature-1 {
algo = "$ramdisk_csum,$ramdisk_sign_algo";
key-name-hint = "$ramdisk_sign_keyname";
};
};
EOF
- fi
+ fi
}
#
@@ -327,19 +327,19 @@
# $1 ... file that's a potential symlink
# $2 ... expected parent directory
symlink_points_below() {
- file="$2/$1"
- dir=$2
+ file="$2/$1"
+ dir=$2
- if ! [ -L "$file" ]; then
- return
- fi
+ if ! [ -L "$file" ]; then
+ return
+ fi
- realpath="$(realpath --relative-to=$dir $file)"
- if [ -z "${realpath%%../*}" ]; then
- return
- fi
+ realpath="$(realpath --relative-to=$dir $file)"
+ if [ -z "${realpath%%../*}" ]; then
+ return
+ fi
- echo "$realpath"
+ echo "$realpath"
}
#
@@ -354,88 +354,88 @@
# $7 ... default flag
fitimage_emit_section_config() {
- conf_csum="${FIT_HASH_ALG}"
- conf_sign_algo="${FIT_SIGN_ALG}"
- conf_padding_algo="${FIT_PAD_ALG}"
- if [ "${UBOOT_SIGN_ENABLE}" = "1" ] ; then
- conf_sign_keyname="${UBOOT_SIGN_KEYNAME}"
- fi
+ conf_csum="${FIT_HASH_ALG}"
+ conf_sign_algo="${FIT_SIGN_ALG}"
+ conf_padding_algo="${FIT_PAD_ALG}"
+ if [ "${UBOOT_SIGN_ENABLE}" = "1" ] ; then
+ conf_sign_keyname="${UBOOT_SIGN_KEYNAME}"
+ fi
- its_file="$1"
- kernel_id="$2"
- dtb_image="$3"
- ramdisk_id="$4"
- bootscr_id="$5"
- config_id="$6"
- default_flag="$7"
+ its_file="$1"
+ kernel_id="$2"
+ dtb_image="$3"
+ ramdisk_id="$4"
+ bootscr_id="$5"
+ config_id="$6"
+ default_flag="$7"
- # Test if we have any DTBs at all
- sep=""
- conf_desc=""
- conf_node="${FIT_CONF_PREFIX}"
- kernel_line=""
- fdt_line=""
- ramdisk_line=""
- bootscr_line=""
- setup_line=""
- default_line=""
+ # Test if we have any DTBs at all
+ sep=""
+ conf_desc=""
+ conf_node="${FIT_CONF_PREFIX}"
+ kernel_line=""
+ fdt_line=""
+ ramdisk_line=""
+ bootscr_line=""
+ setup_line=""
+ default_line=""
- dtb_image_sect=$(symlink_points_below $dtb_image "${EXTERNAL_KERNEL_DEVICETREE}")
- if [ -z "$dtb_image_sect" ]; then
- dtb_image_sect=$dtb_image
- fi
+ dtb_image_sect=$(symlink_points_below $dtb_image "${EXTERNAL_KERNEL_DEVICETREE}")
+ if [ -z "$dtb_image_sect" ]; then
+ dtb_image_sect=$dtb_image
+ fi
- dtb_image=$(echo $dtb_image | tr '/' '_')
- dtb_image_sect=$(echo "${dtb_image_sect}" | tr '/' '_')
+ dtb_image=$(echo $dtb_image | tr '/' '_')
+ dtb_image_sect=$(echo "${dtb_image_sect}" | tr '/' '_')
- # conf node name is selected based on dtb ID if it is present,
- # otherwise its selected based on kernel ID
- if [ -n "$dtb_image" ]; then
- conf_node=$conf_node$dtb_image
- else
- conf_node=$conf_node$kernel_id
- fi
+ # conf node name is selected based on dtb ID if it is present,
+ # otherwise its selected based on kernel ID
+ if [ -n "$dtb_image" ]; then
+ conf_node=$conf_node$dtb_image
+ else
+ conf_node=$conf_node$kernel_id
+ fi
- if [ -n "$kernel_id" ]; then
- conf_desc="Linux kernel"
- sep=", "
- kernel_line="kernel = \"kernel-$kernel_id\";"
- fi
+ if [ -n "$kernel_id" ]; then
+ conf_desc="Linux kernel"
+ sep=", "
+ kernel_line="kernel = \"kernel-$kernel_id\";"
+ fi
- if [ -n "$dtb_image" ]; then
- conf_desc="$conf_desc${sep}FDT blob"
- sep=", "
- fdt_line="fdt = \"fdt-$dtb_image_sect\";"
- fi
+ if [ -n "$dtb_image" ]; then
+ conf_desc="$conf_desc${sep}FDT blob"
+ sep=", "
+ fdt_line="fdt = \"fdt-$dtb_image_sect\";"
+ fi
- if [ -n "$ramdisk_id" ]; then
- conf_desc="$conf_desc${sep}ramdisk"
- sep=", "
- ramdisk_line="ramdisk = \"ramdisk-$ramdisk_id\";"
- fi
+ if [ -n "$ramdisk_id" ]; then
+ conf_desc="$conf_desc${sep}ramdisk"
+ sep=", "
+ ramdisk_line="ramdisk = \"ramdisk-$ramdisk_id\";"
+ fi
- if [ -n "$bootscr_id" ]; then
- conf_desc="$conf_desc${sep}u-boot script"
- sep=", "
- bootscr_line="bootscr = \"bootscr-$bootscr_id\";"
- fi
+ if [ -n "$bootscr_id" ]; then
+ conf_desc="$conf_desc${sep}u-boot script"
+ sep=", "
+ bootscr_line="bootscr = \"bootscr-$bootscr_id\";"
+ fi
- if [ -n "$config_id" ]; then
- conf_desc="$conf_desc${sep}setup"
- setup_line="setup = \"setup-$config_id\";"
- fi
+ if [ -n "$config_id" ]; then
+ conf_desc="$conf_desc${sep}setup"
+ setup_line="setup = \"setup-$config_id\";"
+ fi
- if [ "$default_flag" = "1" ]; then
- # default node is selected based on dtb ID if it is present,
- # otherwise its selected based on kernel ID
- if [ -n "$dtb_image" ]; then
- default_line="default = \"${FIT_CONF_PREFIX}$dtb_image\";"
- else
- default_line="default = \"${FIT_CONF_PREFIX}$kernel_id\";"
- fi
- fi
+ if [ "$default_flag" = "1" ]; then
+ # default node is selected based on dtb ID if it is present,
+ # otherwise its selected based on kernel ID
+ if [ -n "$dtb_image" ]; then
+ default_line="default = \"${FIT_CONF_PREFIX}$dtb_image\";"
+ else
+ default_line="default = \"${FIT_CONF_PREFIX}$kernel_id\";"
+ fi
+ fi
- cat << EOF >> $its_file
+ cat << EOF >> $its_file
$default_line
$conf_node {
description = "$default_flag $conf_desc";
@@ -449,38 +449,38 @@
};
EOF
- if [ -n "$conf_sign_keyname" ] ; then
+ if [ -n "$conf_sign_keyname" ] ; then
- sign_line="sign-images = "
- sep=""
+ sign_line="sign-images = "
+ sep=""
- if [ -n "$kernel_id" ]; then
- sign_line="$sign_line${sep}\"kernel\""
- sep=", "
- fi
+ if [ -n "$kernel_id" ]; then
+ sign_line="$sign_line${sep}\"kernel\""
+ sep=", "
+ fi
- if [ -n "$dtb_image" ]; then
- sign_line="$sign_line${sep}\"fdt\""
- sep=", "
- fi
+ if [ -n "$dtb_image" ]; then
+ sign_line="$sign_line${sep}\"fdt\""
+ sep=", "
+ fi
- if [ -n "$ramdisk_id" ]; then
- sign_line="$sign_line${sep}\"ramdisk\""
- sep=", "
- fi
+ if [ -n "$ramdisk_id" ]; then
+ sign_line="$sign_line${sep}\"ramdisk\""
+ sep=", "
+ fi
- if [ -n "$bootscr_id" ]; then
- sign_line="$sign_line${sep}\"bootscr\""
- sep=", "
- fi
+ if [ -n "$bootscr_id" ]; then
+ sign_line="$sign_line${sep}\"bootscr\""
+ sep=", "
+ fi
- if [ -n "$config_id" ]; then
- sign_line="$sign_line${sep}\"setup\""
- fi
+ if [ -n "$config_id" ]; then
+ sign_line="$sign_line${sep}\"setup\""
+ fi
- sign_line="$sign_line;"
+ sign_line="$sign_line;"
- cat << EOF >> $its_file
+ cat << EOF >> $its_file
signature-1 {
algo = "$conf_csum,$conf_sign_algo";
key-name-hint = "$conf_sign_keyname";
@@ -488,9 +488,9 @@
$sign_line
};
EOF
- fi
+ fi
- cat << EOF >> $its_file
+ cat << EOF >> $its_file
};
EOF
}
@@ -502,114 +502,114 @@
# $2 ... fitImage name
# $3 ... include ramdisk
fitimage_assemble() {
- kernelcount=1
- dtbcount=""
- DTBS=""
- ramdiskcount=$3
- setupcount=""
- bootscr_id=""
- rm -f $1 ${KERNEL_OUTPUT_DIR}/$2
+ kernelcount=1
+ dtbcount=""
+ DTBS=""
+ ramdiskcount=$3
+ setupcount=""
+ bootscr_id=""
+ rm -f $1 ${KERNEL_OUTPUT_DIR}/$2
- if [ -n "${UBOOT_SIGN_IMG_KEYNAME}" -a "${UBOOT_SIGN_KEYNAME}" = "${UBOOT_SIGN_IMG_KEYNAME}" ]; then
- bbfatal "Keys used to sign images and configuration nodes must be different."
- fi
+ if [ -n "${UBOOT_SIGN_IMG_KEYNAME}" -a "${UBOOT_SIGN_KEYNAME}" = "${UBOOT_SIGN_IMG_KEYNAME}" ]; then
+ bbfatal "Keys used to sign images and configuration nodes must be different."
+ fi
- fitimage_emit_fit_header $1
+ fitimage_emit_fit_header $1
- #
- # Step 1: Prepare a kernel image section.
- #
- fitimage_emit_section_maint $1 imagestart
+ #
+ # 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"
+ uboot_prep_kimage
+ fitimage_emit_section_kernel $1 $kernelcount linux.bin "$linux_comp"
- #
- # Step 2: Prepare a DTB image section
- #
+ #
+ # 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
+ 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
- # Skip ${DTB} if it's also provided in ${EXTERNAL_KERNEL_DEVICETREE}
- if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ] && [ -s ${EXTERNAL_KERNEL_DEVICETREE}/${DTB} ]; then
- continue
- fi
+ # Skip ${DTB} if it's also provided in ${EXTERNAL_KERNEL_DEVICETREE}
+ if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ] && [ -s ${EXTERNAL_KERNEL_DEVICETREE}/${DTB} ]; then
+ continue
+ fi
- DTB_PATH="${KERNEL_OUTPUT_DIR}/dts/$DTB"
- if [ ! -e "$DTB_PATH" ]; then
- DTB_PATH="${KERNEL_OUTPUT_DIR}/$DTB"
- fi
+ DTB_PATH="${KERNEL_OUTPUT_DIR}/dts/$DTB"
+ if [ ! -e "$DTB_PATH" ]; then
+ DTB_PATH="${KERNEL_OUTPUT_DIR}/$DTB"
+ fi
- # Skip DTB if we've picked it up previously
- echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue
+ # Skip DTB if we've picked it up previously
+ echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue
- DTBS="$DTBS $DTB"
- DTB=$(echo $DTB | tr '/' '_')
- fitimage_emit_section_dtb $1 $DTB $DTB_PATH
- done
- fi
+ DTBS="$DTBS $DTB"
+ DTB=$(echo $DTB | tr '/' '_')
+ fitimage_emit_section_dtb $1 $DTB $DTB_PATH
+ done
+ fi
- if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ]; then
- dtbcount=1
- for DTB in $(find "${EXTERNAL_KERNEL_DEVICETREE}" \( -name '*.dtb' -o -name '*.dtbo' \) -printf '%P\n' | sort); do
- # Skip DTB if we've picked it up previously
- echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue
+ if [ -n "${EXTERNAL_KERNEL_DEVICETREE}" ]; then
+ dtbcount=1
+ for DTB in $(find "${EXTERNAL_KERNEL_DEVICETREE}" \( -name '*.dtb' -o -name '*.dtbo' \) -printf '%P\n' | sort); do
+ # Skip DTB if we've picked it up previously
+ echo "$DTBS" | tr ' ' '\n' | grep -xq "$DTB" && continue
- DTBS="$DTBS $DTB"
+ DTBS="$DTBS $DTB"
- # Also skip if a symlink. We'll later have each config section point at it
- [ $(symlink_points_below $DTB "${EXTERNAL_KERNEL_DEVICETREE}") ] && continue
+ # Also skip if a symlink. We'll later have each config section point at it
+ [ $(symlink_points_below $DTB "${EXTERNAL_KERNEL_DEVICETREE}") ] && continue
- DTB=$(echo $DTB | tr '/' '_')
- fitimage_emit_section_dtb $1 $DTB "${EXTERNAL_KERNEL_DEVICETREE}/$DTB"
- done
- fi
+ DTB=$(echo $DTB | tr '/' '_')
+ fitimage_emit_section_dtb $1 $DTB "${EXTERNAL_KERNEL_DEVICETREE}/$DTB"
+ done
+ fi
- #
- # Step 3: Prepare a u-boot script section
- #
+ #
+ # Step 3: Prepare a u-boot script section
+ #
- if [ -n "${UBOOT_ENV}" ] && [ -d "${STAGING_DIR_HOST}/boot" ]; then
- if [ -e "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY}" ]; then
- cp ${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} ${B}
- bootscr_id="${UBOOT_ENV_BINARY}"
- fitimage_emit_section_boot_script $1 "$bootscr_id" ${UBOOT_ENV_BINARY}
- else
- bbwarn "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} not found."
- fi
- fi
+ if [ -n "${UBOOT_ENV}" ] && [ -d "${STAGING_DIR_HOST}/boot" ]; then
+ if [ -e "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY}" ]; then
+ cp ${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} ${B}
+ bootscr_id="${UBOOT_ENV_BINARY}"
+ fitimage_emit_section_boot_script $1 "$bootscr_id" ${UBOOT_ENV_BINARY}
+ else
+ bbwarn "${STAGING_DIR_HOST}/boot/${UBOOT_ENV_BINARY} not found."
+ fi
+ fi
- #
- # Step 4: Prepare a setup section. (For x86)
- #
- if [ -e ${KERNEL_OUTPUT_DIR}/setup.bin ]; then
- setupcount=1
- fitimage_emit_section_setup $1 $setupcount ${KERNEL_OUTPUT_DIR}/setup.bin
- fi
+ #
+ # Step 4: Prepare a setup section. (For x86)
+ #
+ if [ -e ${KERNEL_OUTPUT_DIR}/setup.bin ]; then
+ setupcount=1
+ fitimage_emit_section_setup $1 $setupcount ${KERNEL_OUTPUT_DIR}/setup.bin
+ fi
- #
- # Step 5: Prepare a ramdisk section.
- #
- if [ "x${ramdiskcount}" = "x1" ] && [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
- # Find and use the first initramfs image archive type we find
- found=
- for img in ${FIT_SUPPORTED_INITRAMFS_FSTYPES}; do
- initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img"
- if [ -e "$initramfs_path" ]; then
- bbnote "Found initramfs image: $initramfs_path"
- found=true
- fitimage_emit_section_ramdisk $1 "$ramdiskcount" "$initramfs_path"
- break
- else
- bbnote "Did not find initramfs image: $initramfs_path"
- fi
- done
+ #
+ # Step 5: Prepare a ramdisk section.
+ #
+ if [ "x${ramdiskcount}" = "x1" ] && [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
+ # Find and use the first initramfs image archive type we find
+ found=
+ for img in ${FIT_SUPPORTED_INITRAMFS_FSTYPES}; do
+ initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.$img"
+ if [ -e "$initramfs_path" ]; then
+ bbnote "Found initramfs image: $initramfs_path"
+ found=true
+ fitimage_emit_section_ramdisk $1 "$ramdiskcount" "$initramfs_path"
+ break
+ else
+ bbnote "Did not find initramfs image: $initramfs_path"
+ fi
+ done
if [ -z "$found" ] && [ -e ${INITRAMFS_IMAGE} ]; then
found=true
@@ -617,69 +617,69 @@
fitimage_emit_section_ramdisk $1 "$ramdiskcount" "${INITRAMFS_IMAGE}"
fi
- if [ -z "$found" ]; then
- bbfatal "Could not find a valid initramfs type for ${INITRAMFS_IMAGE_NAME}, the supported types are: ${FIT_SUPPORTED_INITRAMFS_FSTYPES}"
- fi
- fi
+ if [ -z "$found" ]; then
+ bbfatal "Could not find a valid initramfs type for ${INITRAMFS_IMAGE_NAME}, the supported types are: ${FIT_SUPPORTED_INITRAMFS_FSTYPES}"
+ fi
+ fi
- fitimage_emit_section_maint $1 sectend
+ 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
+ # Force the first Kernel and DTB in the default config
+ kernelcount=1
+ if [ -n "$dtbcount" ]; then
+ dtbcount=1
+ fi
- #
- # Step 6: Prepare a configurations section
- #
- fitimage_emit_section_maint $1 confstart
+ #
+ # Step 6: Prepare a configurations section
+ #
+ fitimage_emit_section_maint $1 confstart
- # kernel-fitimage.bbclass currently only supports a single kernel (no less or
- # more) to be added to the FIT image along with 0 or more device trees and
- # 0 or 1 ramdisk.
+ # kernel-fitimage.bbclass currently only supports a single kernel (no less or
+ # more) to be added to the FIT image along with 0 or more device trees and
+ # 0 or 1 ramdisk.
# It is also possible to include an initramfs bundle (kernel and rootfs in one binary)
# When the initramfs bundle is used ramdisk is disabled.
- # If a device tree is to be part of the FIT image, then select
- # the default configuration to be used is based on the dtbcount. If there is
- # no dtb present than select the default configuation to be based on
- # the kernelcount.
- 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" "" "$bootscr_id" "" "`expr $i = $dtbcount`"
- else
- fitimage_emit_section_config $1 $kernelcount "$DTB" "$ramdiskcount" "$bootscr_id" "$setupcount" "`expr $i = $dtbcount`"
- fi
- i=`expr $i + 1`
- done
- else
- defaultconfigcount=1
- fitimage_emit_section_config $1 $kernelcount "" "$ramdiskcount" "$bootscr_id" "$setupcount" $defaultconfigcount
- fi
+ # If a device tree is to be part of the FIT image, then select
+ # the default configuration to be used is based on the dtbcount. If there is
+ # no dtb present than select the default configuation to be based on
+ # the kernelcount.
+ 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" "" "$bootscr_id" "" "`expr $i = $dtbcount`"
+ else
+ fitimage_emit_section_config $1 $kernelcount "$DTB" "$ramdiskcount" "$bootscr_id" "$setupcount" "`expr $i = $dtbcount`"
+ fi
+ i=`expr $i + 1`
+ done
+ else
+ defaultconfigcount=1
+ fitimage_emit_section_config $1 $kernelcount "" "$ramdiskcount" "$bootscr_id" "$setupcount" $defaultconfigcount
+ fi
- fitimage_emit_section_maint $1 sectend
+ fitimage_emit_section_maint $1 sectend
- fitimage_emit_section_maint $1 fitend
+ fitimage_emit_section_maint $1 fitend
- #
- # Step 7: Assemble the image
- #
- ${UBOOT_MKIMAGE} \
- ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
- -f $1 \
- ${KERNEL_OUTPUT_DIR}/$2
+ #
+ # Step 7: Assemble the image
+ #
+ ${UBOOT_MKIMAGE} \
+ ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
+ -f $1 \
+ ${KERNEL_OUTPUT_DIR}/$2
- #
- # Step 8: Sign the image
- #
- if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
- ${UBOOT_MKIMAGE_SIGN} \
- ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
- -F -k "${UBOOT_SIGN_KEYDIR}" \
- -r ${KERNEL_OUTPUT_DIR}/$2 \
- ${UBOOT_MKIMAGE_SIGN_ARGS}
- fi
+ #
+ # Step 8: Sign the image
+ #
+ if [ "x${UBOOT_SIGN_ENABLE}" = "x1" ] ; then
+ ${UBOOT_MKIMAGE_SIGN} \
+ ${@'-D "${UBOOT_MKIMAGE_DTCOPTS}"' if len('${UBOOT_MKIMAGE_DTCOPTS}') else ''} \
+ -F -k "${UBOOT_SIGN_KEYDIR}" \
+ -r ${KERNEL_OUTPUT_DIR}/$2 \
+ ${UBOOT_MKIMAGE_SIGN_ARGS}
+ fi
}
diff --git a/meta-phosphor/classes/image_types_phosphor.bbclass b/meta-phosphor/classes/image_types_phosphor.bbclass
index 26af079..607dbbd 100644
--- a/meta-phosphor/classes/image_types_phosphor.bbclass
+++ b/meta-phosphor/classes/image_types_phosphor.bbclass
@@ -126,42 +126,42 @@
FLASH_EXT4_RWFS_CMD:mmc-rwfs-ext4 = "${EXT4_RWFS_CMD}"
mk_empty_image() {
- image_dst="$1"
- image_size_kb=$2
- dd if=/dev/zero bs=1k count=$image_size_kb \
- | tr '\000' '\377' > $image_dst
+ image_dst="$1"
+ image_size_kb=$2
+ dd if=/dev/zero bs=1k count=$image_size_kb \
+ | tr '\000' '\377' > $image_dst
}
mk_empty_image_zeros() {
- image_dst="$1"
- image_size_kb=$2
- dd if=/dev/zero of=$image_dst bs=1k count=$image_size_kb
+ image_dst="$1"
+ image_size_kb=$2
+ dd if=/dev/zero of=$image_dst bs=1k count=$image_size_kb
}
clean_rwfs() {
- type=$1
- shift
+ type=$1
+ shift
- rm -f ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$type
- rm -rf $type
- mkdir $type
+ rm -f ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$type
+ rm -rf $type
+ mkdir $type
}
make_rwfs() {
- type=$1
- cmd=$2
- shift
- shift
- opts="$@"
+ type=$1
+ cmd=$2
+ shift
+ shift
+ opts="$@"
- mkdir -p $type
+ mkdir -p $type
- $cmd $opts
+ $cmd $opts
}
do_generate_rwfs_static() {
- clean_rwfs ${OVERLAY_BASETYPE}
- make_rwfs ${OVERLAY_BASETYPE} "${FLASH_STATIC_RWFS_CMD}" ${OVERLAY_MKFS_OPTS}
+ clean_rwfs ${OVERLAY_BASETYPE}
+ make_rwfs ${OVERLAY_BASETYPE} "${FLASH_STATIC_RWFS_CMD}" ${OVERLAY_MKFS_OPTS}
}
do_generate_rwfs_static[dirs] = " ${S}/static"
do_generate_rwfs_static[depends] += " \
@@ -169,8 +169,8 @@
"
do_generate_rwfs_ubi() {
- clean_rwfs ${FLASH_UBI_OVERLAY_BASETYPE}
- make_rwfs ${FLASH_UBI_OVERLAY_BASETYPE} "${FLASH_UBI_RWFS_CMD}"
+ clean_rwfs ${FLASH_UBI_OVERLAY_BASETYPE}
+ make_rwfs ${FLASH_UBI_OVERLAY_BASETYPE} "${FLASH_UBI_RWFS_CMD}"
}
do_generate_rwfs_ubi[dirs] = " ${S}/ubi"
do_generate_rwfs_ubi[depends] += " \
@@ -178,9 +178,9 @@
"
do_generate_rwfs_ext4() {
- clean_rwfs rwfs.${FLASH_EXT4_OVERLAY_BASETYPE}
- mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.ext4 1024
- make_rwfs ${FLASH_EXT4_OVERLAY_BASETYPE} "${FLASH_EXT4_RWFS_CMD}" ${OVERLAY_MKFS_OPTS}
+ clean_rwfs rwfs.${FLASH_EXT4_OVERLAY_BASETYPE}
+ mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.ext4 1024
+ make_rwfs ${FLASH_EXT4_OVERLAY_BASETYPE} "${FLASH_EXT4_RWFS_CMD}" ${OVERLAY_MKFS_OPTS}
}
do_generate_rwfs_ext4[dirs] = " ${S}/ext4"
do_generate_rwfs_ext4[depends] += " \
@@ -188,22 +188,22 @@
"
add_volume() {
- config_file=$1
- vol_id=$2
- vol_type=$3
- vol_name=$4
- image=$5
- vol_size=$6
+ config_file=$1
+ vol_id=$2
+ vol_type=$3
+ vol_name=$4
+ image=$5
+ vol_size=$6
- echo \[$vol_name\] >> $config_file
- echo mode=ubi >> $config_file
- echo image=$image >> $config_file
- echo vol_type=$vol_type >> $config_file
- echo vol_name=$vol_name >> $config_file
- echo vol_id=$vol_id >> $config_file
- if [ ! -z $vol_size ]; then
- echo vol_size=$vol_size >> $config_file
- fi
+ echo \[$vol_name\] >> $config_file
+ echo mode=ubi >> $config_file
+ echo image=$image >> $config_file
+ echo vol_type=$vol_type >> $config_file
+ echo vol_name=$vol_name >> $config_file
+ echo vol_id=$vol_id >> $config_file
+ if [ ! -z $vol_size ]; then
+ echo vol_size=$vol_size >> $config_file
+ fi
}
python do_generate_ubi() {
@@ -220,31 +220,31 @@
"
do_make_ubi() {
- cfg=ubinize-${IMAGE_NAME}.cfg
- rm -f $cfg ubi-img
- # Construct the ubinize config file
- add_volume $cfg 0 static kernel-${VERSION_ID} \
- ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE}
+ cfg=ubinize-${IMAGE_NAME}.cfg
+ rm -f $cfg ubi-img
+ # Construct the ubinize config file
+ add_volume $cfg 0 static kernel-${VERSION_ID} \
+ ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE}
- add_volume $cfg 1 static rofs-${VERSION_ID} \
- ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_UBI_BASETYPE}
+ add_volume $cfg 1 static rofs-${VERSION_ID} \
+ ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_UBI_BASETYPE}
- add_volume $cfg 2 dynamic rwfs ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_UBI_OVERLAY_BASETYPE} ${FLASH_UBI_RWFS_TXT_SIZE}
+ add_volume $cfg 2 dynamic rwfs ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_UBI_OVERLAY_BASETYPE} ${FLASH_UBI_RWFS_TXT_SIZE}
- # Build the ubi partition image
- ubinize -p ${FLASH_PEB_SIZE}KiB -m ${FLASH_PAGE_SIZE} -o ubi-img $cfg
+ # Build the ubi partition image
+ ubinize -p ${FLASH_PEB_SIZE}KiB -m ${FLASH_PAGE_SIZE} -o ubi-img $cfg
- # Concatenate the uboot and ubi partitions
- mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd ${FLASH_SIZE}
- dd bs=1k conv=notrunc seek=${FLASH_UBOOT_OFFSET} \
- if=${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX} \
- of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd
- dd bs=1k conv=notrunc seek=${FLASH_UBI_OFFSET} \
- if=ubi-img \
- of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd
+ # Concatenate the uboot and ubi partitions
+ mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd ${FLASH_SIZE}
+ dd bs=1k conv=notrunc seek=${FLASH_UBOOT_OFFSET} \
+ if=${DEPLOY_DIR_IMAGE}/u-boot.${UBOOT_SUFFIX} \
+ of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd
+ dd bs=1k conv=notrunc seek=${FLASH_UBI_OFFSET} \
+ if=ubi-img \
+ of=${IMGDEPLOYDIR}/${IMAGE_NAME}.ubi.mtd
- cd ${IMGDEPLOYDIR}
- ln -sf ${IMAGE_NAME}.ubi.mtd ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.ubi.mtd
+ cd ${IMGDEPLOYDIR}
+ ln -sf ${IMAGE_NAME}.ubi.mtd ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.ubi.mtd
}
do_make_ubi[dirs] = "${S}/ubi"
do_make_ubi[depends] += " \
@@ -255,8 +255,8 @@
"
do_mk_static_nor_image() {
- # Assemble the flash image
- mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd ${FLASH_SIZE}
+ # Assemble the flash image
+ mk_empty_image ${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd ${FLASH_SIZE}
}
do_generate_image_uboot_file() {
@@ -335,16 +335,16 @@
}
do_mk_static_symlinks() {
- cd ${IMGDEPLOYDIR}
- ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd
+ cd ${IMGDEPLOYDIR}
+ ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd
- # Maintain non-standard legacy links
- do_generate_image_uboot_file ${IMGDEPLOYDIR}/image-u-boot
- ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/flash-${MACHINE}
- ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/image-bmc
- ln -sf ${FLASH_KERNEL_IMAGE} ${IMGDEPLOYDIR}/image-kernel
- ln -sf ${IMAGE_LINK_NAME}.${IMAGE_BASETYPE} ${IMGDEPLOYDIR}/image-rofs
- ln -sf ${IMAGE_LINK_NAME}.${OVERLAY_BASETYPE} ${IMGDEPLOYDIR}/image-rwfs
+ # Maintain non-standard legacy links
+ do_generate_image_uboot_file ${IMGDEPLOYDIR}/image-u-boot
+ ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/flash-${MACHINE}
+ ln -sf ${IMAGE_NAME}.static.mtd ${IMGDEPLOYDIR}/image-bmc
+ ln -sf ${FLASH_KERNEL_IMAGE} ${IMGDEPLOYDIR}/image-kernel
+ ln -sf ${IMAGE_LINK_NAME}.${IMAGE_BASETYPE} ${IMGDEPLOYDIR}/image-rofs
+ ln -sf ${IMAGE_LINK_NAME}.${OVERLAY_BASETYPE} ${IMGDEPLOYDIR}/image-rwfs
}
do_generate_static[dirs] = "${S}/static"
do_generate_static[depends] += " \
@@ -354,52 +354,52 @@
"
make_signatures() {
- signing_key="${SIGNING_KEY}"
+ signing_key="${SIGNING_KEY}"
- if [ "${INSECURE_KEY}" == "True" ] && [ -n "${SIGNING_PUBLIC_KEY}" ]; then
- echo "Using SIGNING_PUBLIC_KEY"
- signing_key=""
- fi
+ if [ "${INSECURE_KEY}" == "True" ] && [ -n "${SIGNING_PUBLIC_KEY}" ]; then
+ echo "Using SIGNING_PUBLIC_KEY"
+ signing_key=""
+ fi
- if [ -n "${signing_key}" ] && [ -n "${SIGNING_PUBLIC_KEY}" ]; then
- echo "Both SIGNING_KEY and SIGNING_PUBLIC_KEY are defined, expecting only one"
- exit 1
- fi
+ if [ -n "${signing_key}" ] && [ -n "${SIGNING_PUBLIC_KEY}" ]; then
+ echo "Both SIGNING_KEY and SIGNING_PUBLIC_KEY are defined, expecting only one"
+ exit 1
+ fi
- signature_files=""
- if [ -n "${signing_key}" ]; then
- for file in "$@"; do
- openssl dgst -sha256 -sign ${signing_key} -out "${file}.sig" $file
- signature_files="${signature_files} ${file}.sig"
- done
+ signature_files=""
+ if [ -n "${signing_key}" ]; then
+ for file in "$@"; do
+ openssl dgst -sha256 -sign ${signing_key} -out "${file}.sig" $file
+ signature_files="${signature_files} ${file}.sig"
+ done
- if [ -n "${signature_files}" ]; then
- sort_signature_files=$(echo "${signature_files}" | tr ' ' '\n' | sort | tr '\n' ' ')
- cat ${sort_signature_files} > image-full
- openssl dgst -sha256 -sign ${signing_key} -out image-full.sig image-full
- signature_files="${signature_files} image-full.sig"
- fi
- fi
+ if [ -n "${signature_files}" ]; then
+ sort_signature_files=$(echo "${signature_files}" | tr ' ' '\n' | sort | tr '\n' ' ')
+ cat ${sort_signature_files} > image-full
+ openssl dgst -sha256 -sign ${signing_key} -out image-full.sig image-full
+ signature_files="${signature_files} image-full.sig"
+ fi
+ fi
}
do_generate_static_alltar() {
- ln -sf ${S}/MANIFEST MANIFEST
- ln -sf ${S}/publickey publickey
- ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd image-bmc
+ ln -sf ${S}/MANIFEST MANIFEST
+ ln -sf ${S}/publickey publickey
+ ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd image-bmc
- make_signatures image-bmc MANIFEST publickey
+ make_signatures image-bmc MANIFEST publickey
- tar -h -cvf ${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd.all.tar \
- image-bmc MANIFEST publickey ${signature_files}
+ tar -h -cvf ${IMGDEPLOYDIR}/${IMAGE_NAME}.static.mtd.all.tar \
+ image-bmc MANIFEST publickey ${signature_files}
- cd ${IMGDEPLOYDIR}
+ cd ${IMGDEPLOYDIR}
- ln -sf ${IMAGE_NAME}.static.mtd.all.tar \
- ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd.all.tar
+ ln -sf ${IMAGE_NAME}.static.mtd.all.tar \
+ ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.static.mtd.all.tar
- # Maintain non-standard legacy link.
- ln -sf ${IMAGE_NAME}.static.mtd.all.tar \
- ${IMGDEPLOYDIR}/${MACHINE}-${DATETIME}.all.tar
+ # Maintain non-standard legacy link.
+ ln -sf ${IMAGE_NAME}.static.mtd.all.tar \
+ ${IMGDEPLOYDIR}/${MACHINE}-${DATETIME}.all.tar
}
do_generate_static_alltar[vardepsexclude] = "DATETIME"
@@ -411,42 +411,42 @@
"
make_image_links() {
- rwfs=$1
- rofs=$2
- shift
- shift
+ rwfs=$1
+ rofs=$2
+ shift
+ shift
- # Create some links to help make the tar archive in the format
- # expected by phosphor-bmc-code-mgmt.
- do_generate_image_uboot_file image-u-boot
- ln -sf ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} image-kernel
- ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$rofs image-rofs
- ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$rwfs image-rwfs
+ # Create some links to help make the tar archive in the format
+ # expected by phosphor-bmc-code-mgmt.
+ do_generate_image_uboot_file image-u-boot
+ ln -sf ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} image-kernel
+ ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$rofs image-rofs
+ ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$rwfs image-rwfs
}
make_tar_of_images() {
- type=$1
- shift
- extra_files="$@"
+ type=$1
+ shift
+ extra_files="$@"
- # Create the tar archive
- tar -h -cvf ${IMGDEPLOYDIR}/${IMAGE_NAME}.$type.tar \
- image-u-boot image-kernel image-rofs image-rwfs $extra_files
+ # Create the tar archive
+ tar -h -cvf ${IMGDEPLOYDIR}/${IMAGE_NAME}.$type.tar \
+ image-u-boot image-kernel image-rofs image-rwfs $extra_files
- cd ${IMGDEPLOYDIR}
- ln -sf ${IMAGE_NAME}.$type.tar ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$type.tar
+ cd ${IMGDEPLOYDIR}
+ ln -sf ${IMAGE_NAME}.$type.tar ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.$type.tar
}
do_generate_static_tar() {
- ln -sf ${S}/MANIFEST MANIFEST
- ln -sf ${S}/publickey publickey
- make_image_links ${OVERLAY_BASETYPE} ${IMAGE_BASETYPE}
- make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey
- make_tar_of_images static.mtd MANIFEST publickey ${signature_files}
+ ln -sf ${S}/MANIFEST MANIFEST
+ ln -sf ${S}/publickey publickey
+ make_image_links ${OVERLAY_BASETYPE} ${IMAGE_BASETYPE}
+ make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey
+ make_tar_of_images static.mtd MANIFEST publickey ${signature_files}
- # Maintain non-standard legacy link.
- cd ${IMGDEPLOYDIR}
- ln -sf ${IMAGE_NAME}.static.mtd.tar ${IMGDEPLOYDIR}/${MACHINE}-${DATETIME}.tar
+ # Maintain non-standard legacy link.
+ cd ${IMGDEPLOYDIR}
+ ln -sf ${IMAGE_NAME}.static.mtd.tar ${IMGDEPLOYDIR}/${MACHINE}-${DATETIME}.tar
}
do_generate_static_tar[dirs] = " ${S}/static"
do_generate_static_tar[depends] += " \
@@ -596,11 +596,11 @@
"
do_generate_ubi_tar() {
- ln -sf ${S}/MANIFEST MANIFEST
- ln -sf ${S}/publickey publickey
- make_image_links ${FLASH_UBI_OVERLAY_BASETYPE} ${FLASH_UBI_BASETYPE}
- make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey
- make_tar_of_images ubi.mtd MANIFEST publickey ${signature_files}
+ ln -sf ${S}/MANIFEST MANIFEST
+ ln -sf ${S}/publickey publickey
+ make_image_links ${FLASH_UBI_OVERLAY_BASETYPE} ${FLASH_UBI_BASETYPE}
+ make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey
+ make_tar_of_images ubi.mtd MANIFEST publickey ${signature_files}
}
do_generate_ubi_tar[dirs] = " ${S}/ubi"
do_generate_ubi_tar[depends] += " \
@@ -613,38 +613,38 @@
"
do_generate_ext4_tar() {
- # Generate the U-Boot image
- mk_empty_image_zeros image-u-boot ${MMC_UBOOT_SIZE}
- do_generate_image_uboot_file image-u-boot
+ # Generate the U-Boot image
+ mk_empty_image_zeros image-u-boot ${MMC_UBOOT_SIZE}
+ do_generate_image_uboot_file image-u-boot
- # Generate a compressed ext4 filesystem with the fitImage file in it to be
- # flashed to the boot partition of the eMMC
- install -d boot-image
- install -m 644 ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} boot-image/fitImage
- mk_empty_image_zeros boot-image.${FLASH_EXT4_BASETYPE} ${MMC_BOOT_PARTITION_SIZE}
- mkfs.ext4 -F -i 4096 -d boot-image boot-image.${FLASH_EXT4_BASETYPE}
- # Error codes 0-3 indicate successfull operation of fsck
- fsck.ext4 -pvfD boot-image.${FLASH_EXT4_BASETYPE} || [ $? -le 3 ]
- zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} boot-image.${FLASH_EXT4_BASETYPE} > boot-image.${FLASH_EXT4_BASETYPE}.zst
+ # Generate a compressed ext4 filesystem with the fitImage file in it to be
+ # flashed to the boot partition of the eMMC
+ install -d boot-image
+ install -m 644 ${DEPLOY_DIR_IMAGE}/${FLASH_KERNEL_IMAGE} boot-image/fitImage
+ mk_empty_image_zeros boot-image.${FLASH_EXT4_BASETYPE} ${MMC_BOOT_PARTITION_SIZE}
+ mkfs.ext4 -F -i 4096 -d boot-image boot-image.${FLASH_EXT4_BASETYPE}
+ # Error codes 0-3 indicate successfull operation of fsck
+ fsck.ext4 -pvfD boot-image.${FLASH_EXT4_BASETYPE} || [ $? -le 3 ]
+ zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} boot-image.${FLASH_EXT4_BASETYPE} > boot-image.${FLASH_EXT4_BASETYPE}.zst
- # Generate the compressed ext4 rootfs
- zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE} > ${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst
+ # Generate the compressed ext4 rootfs
+ zstd -f -k -T0 -c ${ZSTD_COMPRESSION_LEVEL} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE} > ${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst
- ln -sf boot-image.${FLASH_EXT4_BASETYPE}.zst image-kernel
- ln -sf ${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst image-rofs
- ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.${FLASH_EXT4_OVERLAY_BASETYPE} image-rwfs
- ln -sf ${S}/MANIFEST MANIFEST
- ln -sf ${S}/publickey publickey
+ ln -sf boot-image.${FLASH_EXT4_BASETYPE}.zst image-kernel
+ ln -sf ${IMAGE_LINK_NAME}.${FLASH_EXT4_BASETYPE}.zst image-rofs
+ ln -sf ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.rwfs.${FLASH_EXT4_OVERLAY_BASETYPE} image-rwfs
+ ln -sf ${S}/MANIFEST MANIFEST
+ ln -sf ${S}/publickey publickey
- hostfw_update_file="${DEPLOY_DIR_IMAGE}/hostfw/update/image-hostfw"
- if [ -e "${hostfw_update_file}" ]; then
- ln -sf "${hostfw_update_file}" image-hostfw
- make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey image-hostfw
- make_tar_of_images ext4.mmc MANIFEST publickey ${signature_files} image-hostfw
- else
- make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey
- make_tar_of_images ext4.mmc MANIFEST publickey ${signature_files}
- fi
+ hostfw_update_file="${DEPLOY_DIR_IMAGE}/hostfw/update/image-hostfw"
+ if [ -e "${hostfw_update_file}" ]; then
+ ln -sf "${hostfw_update_file}" image-hostfw
+ make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey image-hostfw
+ make_tar_of_images ext4.mmc MANIFEST publickey ${signature_files} image-hostfw
+ else
+ make_signatures image-u-boot image-kernel image-rofs image-rwfs MANIFEST publickey
+ make_tar_of_images ext4.mmc MANIFEST publickey ${signature_files}
+ fi
}
do_generate_ext4_tar[dirs] = " ${S}/ext4"
do_generate_ext4_tar[depends] += " \
diff --git a/meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass b/meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass
index 277a55c..29073f0 100644
--- a/meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass
+++ b/meta-phosphor/classes/phosphor-deploy-ssh-keys.bbclass
@@ -18,46 +18,46 @@
IMAGE_PREPROCESS_COMMAND += "deploy_local_user;"
deploy_local_user () {
- if [ "${SSH_KEYS}" == "" ]; then
- bbwarn "Trying to deploy SSH keys but input variable is empty (SSH_KEYS)"
- return
- fi
+ if [ "${SSH_KEYS}" == "" ]; then
+ bbwarn "Trying to deploy SSH keys but input variable is empty (SSH_KEYS)"
+ return
+ fi
- ssh_keys="${SSH_KEYS}"
- while [ "${ssh_keys}" != "" ]; do
- current_key=`echo "$ssh_keys" | cut -d ';' -f1`
- ssh_keys=`echo "$ssh_keys" | cut -s -d ';' -f2-`
+ ssh_keys="${SSH_KEYS}"
+ while [ "${ssh_keys}" != "" ]; do
+ current_key=`echo "$ssh_keys" | cut -d ';' -f1`
+ ssh_keys=`echo "$ssh_keys" | cut -s -d ';' -f2-`
- username=`echo "$current_key" | awk -F":" '{ print $1}'`
- key_path=`echo "$current_key" | awk -F":" '{ print $2}'`
+ username=`echo "$current_key" | awk -F":" '{ print $1}'`
+ key_path=`echo "$current_key" | awk -F":" '{ print $2}'`
- if [ ! -d ${IMAGE_ROOTFS}/home/${username} ]; then
- perform_useradd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -p '' ${username}"
- fi
+ if [ ! -d ${IMAGE_ROOTFS}/home/${username} ]; then
+ perform_useradd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -p '' ${username}"
+ fi
- if [ ! -d ${IMAGE_ROOTFS}/home/${username}.ssh/ ]; then
- install -d ${IMAGE_ROOTFS}/home/${username}/.ssh/
- fi
+ if [ ! -d ${IMAGE_ROOTFS}/home/${username}.ssh/ ]; then
+ install -d ${IMAGE_ROOTFS}/home/${username}/.ssh/
+ fi
- if [ ! -f ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys ]; then
- install -m 0600 ${key_path} ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
- else
- cat ${key_path} >> ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
- fi
+ if [ ! -f ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys ]; then
+ install -m 0600 ${key_path} ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
+ else
+ cat ${key_path} >> ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
+ fi
- uid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $3}'`
- guid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $4}'`
+ uid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $3}'`
+ guid=`cat ${IMAGE_ROOTFS}/etc/passwd | grep "${username}:" | awk -F ":" '{print $4}'`
- chown -R ${uid}:${guid} ${IMAGE_ROOTFS}/home/${username}/.ssh
- chmod 600 ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
- chmod 700 ${IMAGE_ROOTFS}/home/${username}/.ssh
+ chown -R ${uid}:${guid} ${IMAGE_ROOTFS}/home/${username}/.ssh
+ chmod 600 ${IMAGE_ROOTFS}/home/${username}/.ssh/authorized_keys
+ chmod 700 ${IMAGE_ROOTFS}/home/${username}/.ssh
- is_group=`grep "priv-admin" ${IMAGE_ROOTFS}/etc/group || true`
+ is_group=`grep "priv-admin" ${IMAGE_ROOTFS}/etc/group || true`
- if [ -z "${is_group}" ]; then
- perform_groupadd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} priv-admin"
- fi
+ if [ -z "${is_group}" ]; then
+ perform_groupadd "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} priv-admin"
+ fi
- perform_usermod "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -a -G priv-admin ${username}"
- done
+ perform_usermod "${IMAGE_ROOTFS}" "-R ${IMAGE_ROOTFS} -a -G priv-admin ${username}"
+ done
}
diff --git a/meta-phosphor/classes/phosphor-rootfs-postcommands.bbclass b/meta-phosphor/classes/phosphor-rootfs-postcommands.bbclass
index 3485661..88ad3c6 100644
--- a/meta-phosphor/classes/phosphor-rootfs-postcommands.bbclass
+++ b/meta-phosphor/classes/phosphor-rootfs-postcommands.bbclass
@@ -2,9 +2,9 @@
# This function is intended to add root to corresponding groups if 'debug-tweaks' or 'allow-root-login' is in IMAGE_FEATURES.
#
update_root_user_groups () {
- if [ -e ${IMAGE_ROOTFS}/etc/group ]; then
- sed -i '/^\(ipmi\|web\|redfish\|priv-admin\):.*:.*:$/s/$/root/' ${IMAGE_ROOTFS}/etc/group
- fi
+ if [ -e ${IMAGE_ROOTFS}/etc/group ]; then
+ sed -i '/^\(ipmi\|web\|redfish\|priv-admin\):.*:.*:$/s/$/root/' ${IMAGE_ROOTFS}/etc/group
+ fi
}
# Add root user to the needed groups
ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains_any("IMAGE_FEATURES", [ 'debug-tweaks', 'allow-root-login' ], "update_root_user_groups; ", "", d)}'