[OE-core] [PATCH v2 2/2] runqemu: Allow the user to override the device tree option
Update the runqemu script to allow the user to specify a device tree to boot when calling runqemu. This involves creating a seperate check_dtb() function incase the user has specified 'none' for the kernel but still wants a device tree. Signed-off-by: Alistair Francis Reviewed-by: Ben Levinsky Cc: Ben Levinsky --- scripts/runqemu | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/runqemu b/scripts/runqemu index c3719a86f7..1be6db0eea 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -69,6 +69,7 @@ Usage: you can run this script with any valid combination of the following environment variables (in any order): KERNEL - the kernel image file to use ROOTFS - the rootfs image file or nfsroot directory to use + DEVICE_TREE - the device tree blob to use MACHINE - the machine name (optional, autodetected from KERNEL filename if unspecified) Simplified QEMU command-line options can be passed with: nographic - disable video console @@ -178,6 +179,7 @@ class BaseConfig(object): self.env_vars = ('MACHINE', 'ROOTFS', 'KERNEL', +'DEVICE_TREE', 'DEPLOY_DIR_IMAGE', 'OE_TMPDIR', 'OECORE_NATIVE_SYSROOT', @@ -579,7 +581,7 @@ class BaseConfig(object): raise RunQemuError("Can't find OVMF firmware: %s" % ovmf) def check_kernel(self): -"""Check and set kernel, dtb""" +"""Check and set kernel""" # The vm image doesn't need a kernel if self.fstype in self.vmtypes: return @@ -608,6 +610,15 @@ class BaseConfig(object): if not os.path.exists(self.kernel): raise RunQemuError("KERNEL %s not found" % self.kernel) +def check_dtb(self): +"""Check and set dtb""" +# Did the user specify a device tree? +if self.get('DEVICE_TREE'): +self.dtb = self.get('DEVICE_TREE') +if not os.path.exists(self.dtb): +raise RunQemuError('Specified DTB not found: %s' % self.dtb) +return + dtb = self.get('QB_DTB') if dtb: cmd_match = "%s/%s" % (deploy_dir_image, dtb) @@ -678,6 +689,7 @@ class BaseConfig(object): self.check_rootfs() self.check_ovmf() self.check_kernel() +self.check_dtb() self.check_biosdir() self.check_mem() self.check_tcpserial() -- 2.11.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH v2 2/2] runqemu: Allow the user to override the device tree option
Doesn't actually work if DEVICE_TREE is not set but QB_DTB is: Traceback (most recent call last): File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-arm-lsb/build/scripts/runqemu", line 1277, in main config.check_and_set() File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-arm-lsb/build/scripts/runqemu", line 692, in check_and_set self.check_dtb() File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-arm-lsb/build/scripts/runqemu", line 624, in check_dtb cmd_match = "%s/%s" % (deploy_dir_image, dtb) NameError: name 'deploy_dir_image' is not defined Ross On 13 October 2017 at 00:32, Alistair Francis wrote: > Update the runqemu script to allow the user to specify a device tree > to boot when calling runqemu. > > This involves creating a seperate check_dtb() function incase the user > has specified 'none' for the kernel but still wants a device tree. > > Signed-off-by: Alistair Francis > Reviewed-by: Ben Levinsky > Cc: Ben Levinsky > --- > scripts/runqemu | 14 +- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/scripts/runqemu b/scripts/runqemu > index c3719a86f7..1be6db0eea 100755 > --- a/scripts/runqemu > +++ b/scripts/runqemu > @@ -69,6 +69,7 @@ Usage: you can run this script with any valid combination > of the following environment variables (in any order): >KERNEL - the kernel image file to use >ROOTFS - the rootfs image file or nfsroot directory to use > + DEVICE_TREE - the device tree blob to use >MACHINE - the machine name (optional, autodetected from KERNEL filename > if unspecified) >Simplified QEMU command-line options can be passed with: > nographic - disable video console > @@ -178,6 +179,7 @@ class BaseConfig(object): > self.env_vars = ('MACHINE', > 'ROOTFS', > 'KERNEL', > +'DEVICE_TREE', > 'DEPLOY_DIR_IMAGE', > 'OE_TMPDIR', > 'OECORE_NATIVE_SYSROOT', > @@ -579,7 +581,7 @@ class BaseConfig(object): > raise RunQemuError("Can't find OVMF firmware: %s" % ovmf) > > def check_kernel(self): > -"""Check and set kernel, dtb""" > +"""Check and set kernel""" > # The vm image doesn't need a kernel > if self.fstype in self.vmtypes: > return > @@ -608,6 +610,15 @@ class BaseConfig(object): > if not os.path.exists(self.kernel): > raise RunQemuError("KERNEL %s not found" % self.kernel) > > +def check_dtb(self): > +"""Check and set dtb""" > +# Did the user specify a device tree? > +if self.get('DEVICE_TREE'): > +self.dtb = self.get('DEVICE_TREE') > +if not os.path.exists(self.dtb): > +raise RunQemuError('Specified DTB not found: %s' % > self.dtb) > +return > + > dtb = self.get('QB_DTB') > if dtb: > cmd_match = "%s/%s" % (deploy_dir_image, dtb) > @@ -678,6 +689,7 @@ class BaseConfig(object): > self.check_rootfs() > self.check_ovmf() > self.check_kernel() > +self.check_dtb() > self.check_biosdir() > self.check_mem() > self.check_tcpserial() > -- > 2.11.0 > > -- > ___ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-core > -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH v2 2/2] runqemu: Allow the user to override the device tree option
On Tue, Nov 14, 2017 at 4:32 AM, Burton, Ross wrote: > Doesn't actually work if DEVICE_TREE is not set but QB_DTB is: > > Traceback (most recent call last): > File > "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-arm-lsb/build/scripts/runqemu", > line 1277, in main > config.check_and_set() > File > "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-arm-lsb/build/scripts/runqemu", > line 692, in check_and_set > self.check_dtb() > File > "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-arm-lsb/build/scripts/runqemu", > line 624, in check_dtb > cmd_match = "%s/%s" % (deploy_dir_image, dtb) > NameError: name 'deploy_dir_image' is not defined Ah! I don't know how that slipped through. Fixed in v3. Thanks for looking at the patch. Alistair > > Ross > > On 13 October 2017 at 00:32, Alistair Francis > wrote: >> >> Update the runqemu script to allow the user to specify a device tree >> to boot when calling runqemu. >> >> This involves creating a seperate check_dtb() function incase the user >> has specified 'none' for the kernel but still wants a device tree. >> >> Signed-off-by: Alistair Francis >> Reviewed-by: Ben Levinsky >> Cc: Ben Levinsky >> --- >> scripts/runqemu | 14 +- >> 1 file changed, 13 insertions(+), 1 deletion(-) >> >> diff --git a/scripts/runqemu b/scripts/runqemu >> index c3719a86f7..1be6db0eea 100755 >> --- a/scripts/runqemu >> +++ b/scripts/runqemu >> @@ -69,6 +69,7 @@ Usage: you can run this script with any valid >> combination >> of the following environment variables (in any order): >>KERNEL - the kernel image file to use >>ROOTFS - the rootfs image file or nfsroot directory to use >> + DEVICE_TREE - the device tree blob to use >>MACHINE - the machine name (optional, autodetected from KERNEL filename >> if unspecified) >>Simplified QEMU command-line options can be passed with: >> nographic - disable video console >> @@ -178,6 +179,7 @@ class BaseConfig(object): >> self.env_vars = ('MACHINE', >> 'ROOTFS', >> 'KERNEL', >> +'DEVICE_TREE', >> 'DEPLOY_DIR_IMAGE', >> 'OE_TMPDIR', >> 'OECORE_NATIVE_SYSROOT', >> @@ -579,7 +581,7 @@ class BaseConfig(object): >> raise RunQemuError("Can't find OVMF firmware: %s" % ovmf) >> >> def check_kernel(self): >> -"""Check and set kernel, dtb""" >> +"""Check and set kernel""" >> # The vm image doesn't need a kernel >> if self.fstype in self.vmtypes: >> return >> @@ -608,6 +610,15 @@ class BaseConfig(object): >> if not os.path.exists(self.kernel): >> raise RunQemuError("KERNEL %s not found" % self.kernel) >> >> +def check_dtb(self): >> +"""Check and set dtb""" >> +# Did the user specify a device tree? >> +if self.get('DEVICE_TREE'): >> +self.dtb = self.get('DEVICE_TREE') >> +if not os.path.exists(self.dtb): >> +raise RunQemuError('Specified DTB not found: %s' % >> self.dtb) >> +return >> + >> dtb = self.get('QB_DTB') >> if dtb: >> cmd_match = "%s/%s" % (deploy_dir_image, dtb) >> @@ -678,6 +689,7 @@ class BaseConfig(object): >> self.check_rootfs() >> self.check_ovmf() >> self.check_kernel() >> +self.check_dtb() >> self.check_biosdir() >> self.check_mem() >> self.check_tcpserial() >> -- >> 2.11.0 >> >> -- >> ___ >> Openembedded-core mailing list >> Openembedded-core@lists.openembedded.org >> http://lists.openembedded.org/mailman/listinfo/openembedded-core > > > > -- > ___ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-core > -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core