From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6597265115990458368 X-Received: by 2002:a50:b125:: with SMTP id k34-v6mr8929055edd.8.1536127718223; Tue, 04 Sep 2018 23:08:38 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a50:c8c9:: with SMTP id k9-v6ls511610edh.1.gmail; Tue, 04 Sep 2018 23:08:37 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbTCGzIM4FzkDviN3Y19/Jc9oFJ8OPIVssqpTlkDi2pYtVi5rMj+LnFwxmyvMSk6wHtZYsA X-Received: by 2002:a50:b1db:: with SMTP id n27-v6mr8848306edd.10.1536127717765; Tue, 04 Sep 2018 23:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536127717; cv=none; d=google.com; s=arc-20160816; b=0Bd1+PYsP2EcKEuHsH7xFaVidcfvk+L85sR1BdvMhPist5fJOuWzU/+0IlDec5IGSk zH6buI0ZZEjtLkW8L7ABGv3cMad2ffi5Nqt6bs4AboJc6zRVX/GHObe70ZH4jgVR7/kd LmnKcDIkXJcBMhi2yG/+CF/8PtZLMKwa6d4M95EPB22rftsITIA/vKBxlwDFLHKO0lWQ H2GwsP4FoOQ3YlrWjYr9A13DjdE/gfdOApVduir5IP5NyPHoeVMqcTeNj0MIRb+nhHQ1 mAUnVDY30MqMTqHMLXG3sMezTgRdZtYUXynBmFLW2b0WOoM8iH/4S7MDdzv3qxPa4DeU n/Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:to:subject; bh=HIxc0t4fwDj9Q+dT5cQpXToidte12G8+xRkkGlRBUe4=; b=oYPAHtkzTZtwdIn6amQo32sCd3+QB71Oap1BbyfG3SrwF2kByKb2i9i4TxqblhdD7n mIAMZPuruM047FHv+M33L6EQSuXrdBb0LbkRbyxCp8EcW/QZnxncvbN+dMHM1ADp90o9 +azcGzYxu+jqGs9oaizVe3pyR3W0EESHJp2eWRZYEyZnn7KNE1ETbA0GUfN0LDhhrusd 58hmKm1CaENuTu4tPQQAB2laI2bxqP96HLx7gsnanpMh4gRPRS9W1PNIKUYft8slkjfD 3UcGrnpvYUOSvuebhutH6PDgYw8PkXKKBYLD3lcbryN2rWgClxkj9MncxlLWDmxqr0j8 fAQA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id o55-v6si54685edo.3.2018.09.04.23.08.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 23:08:37 -0700 (PDT) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id w8568aL0026158 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Sep 2018 08:08:36 +0200 Received: from [139.22.38.104] ([139.22.38.104]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id w8568ZLB002226; Wed, 5 Sep 2018 08:08:36 +0200 Subject: Re: [RFC] Interface for installing bootloaders To: Claudius Heine , isar-users , Claudius Heine , Henning Schild , Andreas Reichel References: <0aeb9010-8fed-6094-ac12-41983c3831ae@siemens.com> <4ae0dc9d-7fa4-9fa0-7844-aab25579fdb7@siemens.com> From: Jan Kiszka Message-ID: Date: Wed, 5 Sep 2018 08:08:35 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <4ae0dc9d-7fa4-9fa0-7844-aab25579fdb7@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-TUID: /aylL0e0X2R9 On 2018-09-04 11:27, Claudius Heine wrote: > Hi Jan, > > On 2018-09-04 09:17, [ext] Jan Kiszka wrote: >> Hi all, >> >> for installing a bootloader into an image, a number of packages have >> to be installed into the buildchroot. These can be prebuilt packages >> or packages we build via Isar. Currently, we only handle the case of >> WIC requiring prebuilt Debian packages, and that in a hacky way (no >> proper distro abstraction, unneeded installation of unused >> dependencies). This proposal aims at providing a more holistic solution: >> >> - Introduce new variables that express the two types of dependencies: >>     - BOOTLOADER_PREBUILT >>     - BOOTLOADER_CUSTOM >> >>    So there is no "WIC" in these, any imaging recipe can use them. >> >> - Imaging recipes (e.g. via classes/wic-img.bbclass) should >>     - install all packages from BOOTLOADER_PREBUILT and BOOTLOADER_CUSTOM >>       into the buildchroot >>     - DEPEND on all recipes in BOOTLOADER_CUSTOM >> >> - Define some common dependencies in conf/distro/${DISTRO}.conf: >>     - GRUB_PREBUILT >>     - GRUB_PREBUILT_append_${DISTRO_ARCH} >>     - SYSLINUX_PREBUILT >>     - ... >> >>    Those variables can then be used to initialize BOOTLOADER_PREBUILT as >>    needed and also replace those nasty BUILDCHROOT_PREINSTALL_WIC in >>    buildchroot-target.bb. >> >> - Set BOOTLOADER_PREBUILT or BOOTLOADER_CUSTOM in the >>    conf/machine/${MACHINE}.conf or some overriding conf file - basically >>    the same one that selects IMAGE_TYPE and WKS_FILE. >> >> Anything I missed? Better suggestions? Eventually, when we can derive >> bitbake recipe dependencies automatically from package dependencies, >> PREBUILT and CUSTOM could be folded together. Right now, we need that >> split. >> >> Jan > > I have a class that I use for the current project that allows installing > additional packages into the buildchroot from within the image. I didn't > had time to prepare patches for it for mainline isar. But maybe that > goes into to right direction. > > I attached it. ... > BUILDCHROOT_EXTRA_INSTALL ??= "" > > MOUNT_LOCKFILE = "${BUILDCHROOT_DIR}/mount.lock" > > BUILDCHROOT_DIR ??= "${BUILDCHROOT_TARGET_DIR}" > BUILDCHROOT_BUILD_DEP ??= "buildchroot-target:do_build" > > do_buildchroot_extra_install[depends] = "${BUILDCHROOT_BUILD_DEP}" > do_buildchroot_extra_install[deptask] = "do_deploy_deb" > do_buildchroot_extra_install[stamp-extra-info] = "${DISTRO}-${MACHINE}" > do_buildchroot_extra_install() { > PACKAGES="${@" ".join(d.getVar("BUILDCHROOT_EXTRA_INSTALL", True).split())}" > Can you explain the magic dance in the line above? I don't see its need yet. > if [ -z "$PACKAGES" ]; then ...provided you do "[ -z $VAR ]" here to catch VAR=" ". > bbnote "No packages installed" > exit > fi > > sudo flock ${MOUNT_LOCKFILE} -c ' \ > if ! grep -q ${BUILDCHROOT_DIR}/isar-apt /proc/mounts; then > mount --bind ${DEPLOY_DIR_APT}/${DISTRO} ${BUILDCHROOT_DIR}/isar-apt > mount --bind ${DL_DIR} ${BUILDCHROOT_DIR}/downloads > mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${BUILDCHROOT_DIR}/dev > mount -t proc none ${BUILDCHROOT_DIR}/proc > fi' > > sudo chroot ${BUILDCHROOT_DIR} \ > apt-get update \ > -o Dir::Etc::sourcelist="sources.list.d/multistrap-isar-apt.list" \ > -o Dir::Etc::sourceparts="-" \ > -o APT::Get::List-Cleanup="0" > > sudo chroot ${BUILDCHROOT_DIR} \ > apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y \ > --allow-unauthenticated install \ > $PACKAGES > } > > addtask buildchroot_extra_install before do_rootfs Thanks, Jan