scripts/common: Extract SPDK_GPT_PART_TYPE_GUID from source

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Id22c28c46a5fbdf5bd76b31d16f07f2672dfe14e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9306
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@gmail.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Michal Berger 2021-08-26 09:28:37 +02:00 committed by Jim Harris
parent 76f840c049
commit b794726807
2 changed files with 12 additions and 3 deletions

View File

@ -345,6 +345,17 @@ block_in_use() {
return 0
}
get_spdk_gpt() {
local spdk_guid
[[ -e $rootdir/module/bdev/gpt/gpt.h ]] || return 1
IFS="()" read -r _ spdk_guid _ < <(grep SPDK_GPT_PART_TYPE_GUID "$rootdir/module/bdev/gpt/gpt.h")
spdk_guid=${spdk_guid//, /-} spdk_guid=${spdk_guid//0x/}
echo "$spdk_guid"
}
if [[ -e "$CONFIG_WPDK_DIR/bin/wpdk_common.sh" ]]; then
# Adjust uname to report the operating system as WSL, Msys or Cygwin
# and the kernel name as Windows. Define kill() to invoke the SIGTERM

View File

@ -79,9 +79,7 @@ function setup_gpt_conf() {
# Create gpt partition table
parted -s "$gpt_nvme" mklabel gpt mkpart first '0%' '50%' mkpart second '50%' '100%'
# change the GUID to SPDK GUID value
# FIXME: Hardcode this in some common place, this value should not be changed much
IFS="()" read -r _ SPDK_GPT_GUID _ < <(grep SPDK_GPT_PART_TYPE_GUID module/bdev/gpt/gpt.h)
SPDK_GPT_GUID=${SPDK_GPT_GUID//, /-} SPDK_GPT_GUID=${SPDK_GPT_GUID//0x/}
SPDK_GPT_GUID=$(get_spdk_gpt)
sgdisk -t "1:$SPDK_GPT_GUID" "$gpt_nvme"
sgdisk -t "2:$SPDK_GPT_GUID" "$gpt_nvme"
"$rootdir/scripts/setup.sh"