S820A QNX Hypervisor Software User Guide
80-CF838-1 Rev.
Img 生成脚本:
target/hypervisor/host/create_images.sh
tools/build/image-builder.sh
The QVM config file for the guest is instantiated within the host rootfs build file, located at root/target/hypervisor/qvm/$project/build_files/system.build.tmpl
startup.sh
Based on the requirements, services that are not critical to boot, can be launched programmatically using startup script.
Script location is under: /qnx_ap/target/hypervisor/host/startup.qvmhost.tmpl
target/hypervisor/host/create_images.sh +898
将startup.qvmhost.tmpl拷贝到out目录下更名为startup-qvmhost.sh
target/hypervisor/host/out_8540/system.build_la +990
将startup-qvmhost.sh放到/sritpts/startup中
编译后生成的startup脚本
Qnx 的宏定义都在这个脚本中:
target/hypervisor/host/out_8540/platform_variables.sh
startupmgr
qnx_ap/target/hypervisor/host/startupmgr/src/script.c
build_files/makena_qdrive_mifs.build.tmpl
target/filesets/launcher_scripts/devb-host.c:257: .path = "/mnt/scripts/startup.sh",
target/hypervisor/host/startupmgr/makena_qdrive_poc/src/script.c:110:
target/hypervisor/host/startupmgr/src/script.c
create_variant_images.sh log输出
bash create_variant_images.sh
8540
#######################
CFG File:./variant_config/8540.cfg
Variant File:./variant_config/8540_la.txt
mvariant:_la
ext_name:_la
SOC_NAME:8540
create_images.sh
#!/bin/sh
# The .cfg files contain the SOC specific ifdefs which are used during compile time
# The .txt files contain the flavor ( variant and subvariant) specific ifdefs
# target/
# |__hypervisor/
# |__ host/
# |__variant_config/
# |__ <SOC>.cfg
# |__ <SOC>_<variant>_<subvariant(optional)>.txt
#
# Each 'variant' corresponds to a unique device tree.
# The subvariant uses the same device tree / memory map / qcpe config as the
# main variant if a separate file for the subvariant is not specified .It allows additional ifdefs for some conditional compilation.
# Avoid use of subvariants as much as possible.
#
# target/
# |__filesets/
# | |__ sdm_<SOC>.dtsi ( SOC specific dtsi )
# | |__ sdm-host_common.dtsi ( common dtsi )
# |__hypervisor/
# |__ host/
# |__fdt_config/
# |_dtb/
# |_sdm-host.dts ( main dts file )
# |_sdm-host_<variant>.dts ( variant specific dts file )
#Memory Map
#
#list of <SOC>.cfg files
LIST=`ls ./variant_config/*.cfg`
function get_soc_name()
{
SOC_NAME=`basename $1 | sed "s/\..*//"`
export SOC_CONFIG=$1
export SOC_NAME
if [ -d "${BSP_ROOT}/target/hypervisor/gvm/ivi/la" ]; then
if [ -d "${BSP_ROOT}/target/hypervisor/gvm/ivi/lv" ]; then
LIST1=`ls ./variant_config/${SOC_NAME}*.txt`
else
LIST1=`ls ./variant_config/${SOC_NAME}_la*.txt`
fi
else
if [ -d "${BSP_ROOT}/target/hypervisor/gvm/ivi/lv" ]; then
LIST1=`ls ./variant_config/${SOC_NAME}_lv*.txt`
else
LIST1=`ls ./variant_config/${SOC_NAME}*.txt`
fi
fi
echo $SOC_NAME
export OUT_DIR=out_${SOC_NAME}
}
function delete_out_dir()
{
rm -rf ./${OUT_DIR}
}
function create_out_dir()
{
if [ ! -d ./${OUT_DIR} ]
then
mkdir ./${OUT_DIR}
fi
}
function create_image()
{
rm -f ${SOC_NAME}${ext_name}.txt
cat $1 >> ${SOC_NAME}${ext_name}.txt
if [ -e $VENDOR_VARIANT ]; then
cat $VENDOR_VARIANT >> ${SOC_NAME}${ext_name}.txt
export SOC_VARIANT=$(readlink -f ${SOC_NAME}${ext_name}.txt)
fi
bash ${BSP_ROOT}/target/hypervisor/host/create_images.sh $2
if [ $? -ne 0 ] ; then
exit 1;
fi
}
function split_vars()
{
IFS='_' # underscore is the delimiter
read -a VARIANT_INFO <<< "$1"
# For internal variant testing
if [ ! -z ${VARIANT_INFO[2]} ];then
export ext_name=_${VARIANT_INFO[1]}_${VARIANT_INFO[2]}
else
export ext_name=_${VARIANT_INFO[1]}
fi
# strip the preceding underscore
export variant_name="${ext_name:1}"
export mvariant=_${VARIANT_INFO[1]} #_la
cfg_file=./variant_config/${VARIANT_INFO[0]}.cfg #./variant_config/8540.cfg
txt_file=./variant_config/${VARIANT_INFO[0]}$ext_name.txt #/variant_config/8540_la.txt
# Restore IFS since its being this function is being
# called from a FOR loop
echo "#######################"
echo "CFG File:$cfg_file"
echo "Variant File:$txt_file"
echo "mvariant:$mvariant"
echo "ext_name:$ext_name"
echo "SOC_NAME:$SOC_NAME"
echo "#######################"
unset IFS
}
#accepts the flavor as option , for e.g 8155_la, 8155_multi,etc
if [ $# -ne 0 ]
then
if [ "help" = $1 ]; then
echo "help"
echo "./create_variant_images.sh --> Build all images ( default )"
echo "./create_variant_images.sh <flavor> <ifs> "
echo "Check ./variant_config/<flavor>.txt for supported flavors"
echo "flavor should be of format soc_<variant with no underscores>_<subvariant>"
echo " The subvariant in this case will use the same dts/memory map/qcpe
",config , etc as the main variant. But This allows you to have additional
echo " env variables for a slight update to the main variant"
echo "e.g Creates all images for variants: ./create_variant_images.sh 8155_la"
echo "e.g Creates only ifs image for variant: ./create_variant_images.sh 8155_la ifs"
exit
fi
export flavor=$1
split_vars $1
get_soc_name $cfg_file
create_out_dir
echo $txt_file
create_image $txt_file $2
exit
fi
#Loop over each <SOC>.cfg file in variant_confg
for config_file in ${LIST}; do #./variant_config/8540.cfg
# call to get the $SOC_NAME
get_soc_name $config_file
#delete_out_dir
# Loop over the <flavors>.txt for each SOC
for os_file in ${LIST1}; do
# Get the flavor_subvariant
flavor=`basename $os_file`
export flavor=${flavor%.txt} #flavor 8540_la
# look for flavor subvariant
split_vars $flavor
create_out_dir
# call to process the new vars
if [[ "$qnx_toolchain" == QNX710 ]] || [[ "$qnx_toolchain" == QOS220 ]] || [[ "$qnx_toolchain" == QOS222 ]]; then
if [[ "$txt_file" == *_qdrive* ]] || [[ "$txt_file" == *_srv1m* ]] || [[ "$txt_file" == *_slt* ]] ; then
create_image $txt_file
fi
elif [[ "$qnx_toolchain" == HYP710 ]] || [[ "$qnx_toolchain" == QHS220 ]]; then
if [[ "$txt_file" != *_qdrive* ]]; then
create_image $txt_file
fi
else
echo "Config $txt_file doesnt match the toolchain $qnx_toolchain"
exit 1;
fi
if [ $? -ne 0 ]; then
exit 1;
fi
done
done
rm -f ${SOC_NAME}${ext_name}.txt
apps/qnx_ap/target/hypervisor/host/startupmgr/8540_la 目录不存在
使用apps/qnx_ap/target/hypervisor/host/startupmgr/src/script.c
static const struct aaction* diskservices[] = {
&reopen_serdev,
&devb_ufs,
&gpt_makelink_ufs,
&fs_mount_firmware,
&fs_mount_persist,
&early_security_services,
&fs_mount_svp_qtd,
&fs_mount_svp,
&fs_mount_system_qtd,
&fs_mount_system,
&next_startup,
//Delimit with NULL
NULL,
};
static const struct launcher_script scripts [] = {
/*host IFSs*/
{
.ifsname = "ifs_coreservices.img",
.actions = coreservices,
.sha256sum = __ifs_coreservices__hash__,
},
{
.ifsname = "ifs_audio.img",
.actions = audioservices,
.sha256sum = __ifs_audio__hash__,
.sleep_pre_dma = 0,
.sleep_pre_sha = 0,
.type = "IFS",
},
{
.ifsname = "ifs_display.img",
.actions = dispservices,
.sha256sum = __ifs_display__hash__,
.sleep_pre_dma = 0,
.sleep_pre_sha = 0,
.type = "IFS",
},
{
.ifsname = "ifs_graphics.img",
.actions = graphicsservices,
.sha256sum = __ifs_graphics__hash__,
.sleep_pre_dma = 80000,
.sleep_pre_sha = 0,
.type = "IFS",
},
{
.ifsname = "ifs_camera.img",
.actions = cameraservices,
.sha256sum = __ifs_camera__hash__,
.sleep_pre_dma = 0,
.sleep_pre_sha = 0,
.type = "IFS",
},
{
.ifsname = "ifs_video.img",
.actions = videoservices,
.sha256sum = __ifs_video__hash__,
.sleep_pre_dma = 0,
.sleep_pre_sha = 0,
.type = "IFS",
},
{
.ifsname = "ifs_disk.img" ,
.actions = diskservices ,
.sha256sum = __ifs_disk__hash__ ,
.type = "IFS",
},
//Delimt with NULL,
{ NULL , NULL },
};
int main ( int argc, char** argv ) {
bmetrics_log_component_start();
return init_loader_and_launcher ( argc, argv, scripts );
}
init_loader_and_launcher 解析launcher_script mount ifsname & load action server
apps/qnx_ap/AMSS/platform/services/applications/ifsloader/ifsloader.c
int init_loader_and_launcher ( int argc, char** argv, const struct launcher_script* scripts )
{
int rc;
struct arguments_info argu;
pthread_t loader_thread;
argu.argc = argc;
argu.argv = a