diff options
Diffstat (limited to 'images')
| -rw-r--r-- | images/CrOS.sh | 48 | ||||
| -rw-r--r-- | images/FIT.sh | 83 | ||||
| -rw-r--r-- | images/srec.sh | 18 | ||||
| -rw-r--r-- | images/uImage.sh | 9 | 
4 files changed, 158 insertions, 0 deletions
diff --git a/images/CrOS.sh b/images/CrOS.sh new file mode 100644 index 0000000..eb9ff05 --- /dev/null +++ b/images/CrOS.sh @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: GPL-2.0+ + +if [[ $arch != arm64 && $arch != x86 ]] ; then +	echo "CrOS image unsupported on architecture $arch" +	exit 1 +fi + +source "${kbuild_root}/images/FIT.sh" || exit 1 + +make_CrOS_image() { +	local boot_dir=$output_dir/arch/$arch/boot +	local bootloader +	local config +	local vmlinuz + +	if [[ $arch == arm64 ]] ; then +		make_FIT_image +		vmlinuz=$boot_dir/kernel_fdt.itb +	elif [[ $arch == x86 ]] ; then +		vmlinuz=$boot_dir/bzImage +	fi + +	if [[ -f $opt_bootloader ]] ; then +		bootloader=$opt_bootloader +	else +		dd if=/dev/zero of=$boot_dir/bootloader bs=512 count=1 +		bootloader=$boot_dir/bootloader +	fi + +	if [[ -f $opt_cmdline_file ]] ; then +		config=$opt_cmdline_file +	else +		echo "$CMDLINE" > $boot_dir/cmdline +		config=$boot_dir/cmdline +	fi + +	vbutil_kernel \ +		--pack $boot_dir/vmlinuz.image \ +		--version 1 \ +		--vmlinuz $vmlinuz \ +		--arch $arch \ +		--keyblock /usr/share/vboot/devkeys/kernel.keyblock \ +		--signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \ +		--config $config \ +		--bootloader $bootloader +} + +image_file=$output_dir/arch/$arch/boot/vmlinuz.image diff --git a/images/FIT.sh b/images/FIT.sh new file mode 100644 index 0000000..0ed5482 --- /dev/null +++ b/images/FIT.sh @@ -0,0 +1,83 @@ +# SPDX-License-Identifier: GPL-2.0+ + +make_FIT_image() { +	local kernel_its=$output_dir/arch/$arch/boot/kernel_fdt.its + +	cat <<EOF > $kernel_its +/dts-v1/; +/ { +	description = "Kernel + FDT image for $board board"; +	#address-cells = <1>; + +	images { +		kernel { +			description = "Linux kernel"; +			data = /incbin/("$output_dir/arch/$arch/boot/$image_kernel"); +			type = "kernel"; +			arch = "$arch"; +			os = "linux"; +			compression = "none"; +			load = <$LOADADDR>; +			entry = <$LOADADDR>; +			hash-1 { +				algo = "crc32"; +			}; +			hash-2 { +				algo = "sha1"; +			}; +		}; +EOF + +	local dtb + +	for dtb in $DTBS ; do +		local src=${dtb/:*/} +		local dst=${dtb/*:/} +		dst=${dst/*\//} + +		cat <<EOF >> $kernel_its +		fdt-$dst { +			description = "Flattened Device Tree blob $dst"; +			data = /incbin/("$output_dir/arch/$arch/boot/dts/$src"); +			type = "flat_dt"; +			arch = "$arch"; +			compression = "none"; +			hash-1 { +				algo = "crc32"; +			}; +			hash-2 { +				algo = "sha1"; +			}; +		}; +EOF +	done + +	local config=$(echo $DTBS | sed 's/.*[:/]//') +	cat <<EOF >> $kernel_its +	}; + +	configurations { +		default = "conf-$config"; +EOF +	for dtb in $DTBS ; do +		local dst=${dtb/*:/} +		dst=${dst/*\//} + +		cat <<EOF >> $kernel_its +		conf-$dst { +			description = "Boot Linux kernel with $dst blob"; +			kernel = "kernel"; +			fdt = "fdt-$dst"; +		}; +EOF +	done + +	cat <<EOF >> $kernel_its +	}; +}; +EOF + +	PATH="$output_dir/scripts/dtc:$PATH" mkimage -f $kernel_its ${kernel_its/its/itb} +} + +image_file=$output_dir/arch/$arch/boot/kernel_fdt.itb diff --git a/images/srec.sh b/images/srec.sh new file mode 100644 index 0000000..6f89b92 --- /dev/null +++ b/images/srec.sh @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0+ + +make_srec_image() { +	local image=$output_dir/arch/$arch/boot/$image_kernel + +	cat $image | lzma -z -e > $image.xz +	objcopy -I binary -O srec --srec-forceS3 --srec-len 516 \ +		$image.xz $image.xz.srec + +	for dtb in $DTBS ; do +		local src=${dtb/:*/} + +		objcopy -I binary -O srec --srec-forceS3 --srec-len 516 \ +			$src $src.srec +	done +} + +image_file=$output_dir/arch/$arch/boot/$kernel_image.xz.srec diff --git a/images/uImage.sh b/images/uImage.sh new file mode 100644 index 0000000..40e7cf3 --- /dev/null +++ b/images/uImage.sh @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0+ + +make_uImage_image() { +	mkimage -A $arch -O linux -T kernel -C none -a $LOADADDR -e $LOADADDR \ +		-n "Linux-${version}" -d $output_dir/arch/$arch/boot/$kernel_image \ +		$output_dir/arch/$arch/boot/uImage +} + +image_file=$output_dir/arch/$arch/boot/uImage  | 
