poky.lists.yoctoproject.org archive mirror
 help / color / mirror / Atom feed
From: "Chen, Qi" <Qi.Chen@windriver.com>
To: "nicolas.wirth@speedgoat.ch" <nicolas.wirth@speedgoat.ch>,
	"poky@lists.yoctoproject.org" <poky@lists.yoctoproject.org>
Subject: RE: [poky] Running chroot-like command in Yocto #yocto
Date: Thu, 16 May 2024 03:36:39 +0000	[thread overview]
Message-ID: <CO6PR11MB560246500A31280B432B45F5EDED2@CO6PR11MB5602.namprd11.prod.outlook.com> (raw)
In-Reply-To: <19808.1715784120309934958@lists.yoctoproject.org>

[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]

I haven't tried, but you can test with the following approach:

  1.  Setup nopasswd sudo
  2.  In you custom command, disable pseudo (export PSEUDO_UNLOAD=1)
  3.  Run 'sudo chroot ...'
  4.  You may also need to enable the 'network' flag for do_rootfs/do_image_xxx task (whichever task your command is run in) to avoid namespace messing things up. E.g., do_rootfs['network'] = 1

Anyway, if you can find a way to adjust syslinux class to add extra functionality to it, that would be best.

Regards,
Qi

From: poky@lists.yoctoproject.org <poky@lists.yoctoproject.org> On Behalf Of Nicolas Wirth via lists.yoctoproject.org
Sent: Wednesday, May 15, 2024 10:42 PM
To: poky@lists.yoctoproject.org
Subject: Re: [poky] Running chroot-like command in Yocto #yocto

That's not entirely true. The syslinux class does indeed a lot of this, I was able to experiment with this using the live hddimage. However, this mechanism ends up creating 2 different partitions, one containing the bootloader, and one containing the rootfs. I would like to have them in the same partition. I was able to find how to do it by scripting, but it's outside of the build environment. My script looks like this:

loop_dev=$(losetup --find --partscan --show "my-image-genericx86-64.wic")

if [[ -z "$loop_dev" ]]; then

    echo "Failed to set up loop device!"

    exit 1

fi



if [[ "$arch" == "amd64" ]]; then

    echo "Setting up Extlinux"

    mount_dir=$(mktemp --directory)

    mount ${loop_dev}p1 ${mount_dir}

    extlinux --install ${mount_dir}/boot/syslinux

    umount ${loop_dev}p1

fi


[-- Attachment #2: Type: text/html, Size: 18103 bytes --]

      reply	other threads:[~2024-05-16  3:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-15 12:14 Running chroot-like command in Yocto #yocto Nicolas Wirth
2024-05-15 12:19 ` [poky] " Alexander Kanavin
2024-05-15 12:34   ` Nicolas Wirth
2024-05-15 13:08     ` [poky] " Alexander Kanavin
2024-05-15 13:52     ` Ross Burton
2024-05-15 14:42       ` Nicolas Wirth
2024-05-16  3:36         ` Chen, Qi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO6PR11MB560246500A31280B432B45F5EDED2@CO6PR11MB5602.namprd11.prod.outlook.com \
    --to=qi.chen@windriver.com \
    --cc=nicolas.wirth@speedgoat.ch \
    --cc=poky@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).