[oe] [meta-initramfs][PATCH 3/7 v2] dracut: Add execute_dracut opkg intercept script

Böszörményi Zoltán zboszor at pr.hu
Mon Mar 4 09:04:14 UTC 2019


2019. 03. 03. 23:05 keltezéssel, Khem Raj írta:
> On Tue, Feb 26, 2019 at 1:55 AM Böszörményi Zoltán <zboszor at pr.hu> wrote:
>>
>> Signed-off-by: Böszörményi Zoltán <zboszor at pr.hu>
>> ---
>> v2: The script name is execute_dracut, not execute-dracut
>>      so it is identical to the postinst-intercepts variant.
>>
>>   .../dracut/dracut/execute_dracut              | 21 +++++++++++++++++++
>>   .../recipes-devtools/dracut/dracut_git.bb     |  5 +++++
>>   2 files changed, 26 insertions(+)
>>   create mode 100755 meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut
>>
>> diff --git a/meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut b/meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut
>> new file mode 100755
>> index 000000000..96bcc92ed
>> --- /dev/null
>> +++ b/meta-initramfs/recipes-devtools/dracut/dracut/execute_dracut
>> @@ -0,0 +1,21 @@
>> +#!/bin/sh
>> +
>> +if [ ! -f $OPKG_INTERCEPT_DIR/execute-dracut ]; then
>> +       KERNEL_VERSION=$1
>> +       shift
>> +       MY_KERNEL_VERSION=$(readlink /boot/bzimage | sed 's,^.*bzImage-,,')
> 
> this assumption breaks all image builds for qemux86 and qemux86_64
> unless that is fixed, it will be hard to accept this series. bzImage
> is not the kernel name always

I have read kernel.bbclass more closely and I can use ${KERNEL_IMAGETYPE}
and ${KERNEL_IMAGEDEST} to remove these assumptions.

> and may not be present in rootfs all the
> time.

Now, based on the code of kernel.bbclass, it's hard to believe that
the kernel image is not always present in rootfs.

According to the code in kernel.bbclass
${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} will always be
a symlink to ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} in the same
directory.

> 
> ERROR: yoe-simple-image-1.0-r0 do_rootfs: The postinstall intercept
> hook 'execute_dracut' failed, details in
> /mnt/a/yoe/build/tmp/work/qemux86-yoe-linux/yoe-s
> imple-image/1.0-r0/temp/log.do_rootfs
> ERROR: yoe-simple-image-1.0-r0 do_rootfs:
> ERROR: yoe-simple-image-1.0-r0 do_rootfs: Function failed: do_rootfs
> 
> 
> 
>> +       if [[ -z "$MY_KERNEL_VERSION" ]]; then
>> +               if [[ -d /lib/modules/$KERNEL_VERSION ]]; then
>> +                       MY_KERNEL_VERSION="${KERNEL_VERSION}"
>> +               fi
>> +       fi
>> +       [[ -z "$MY_KERNEL_VERSION" ]] && echo COULD NOT DETERMINE KERNEL VERSION TO RUN DEPMOD AND DRACUT && echo PLEASE DO IT MANUALLY && exit 0
>> +       cat <<EOF > $OPKG_INTERCEPT_DIR/execute-dracut
>> +echo RUNNING: depmod -a $MY_KERNEL_VERSION
>> +depmod -a $MY_KERNEL_VERSION
>> +echo RUNNING: dracut -f $@ /boot/initramfs.img $MY_KERNEL_VERSION
>> +echo "dracut: $(dracut --help | grep 'Version:')"
>> +dracut -f $@ /boot/initramfs.img $MY_KERNEL_VERSION
>> +EOF
>> +       chmod +x $OPKG_INTERCEPT_DIR/execute-dracut
>> +fi
>> diff --git a/meta-initramfs/recipes-devtools/dracut/dracut_git.bb b/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
>> index a1d7cb119..cb49d9539 100644
>> --- a/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
>> +++ b/meta-initramfs/recipes-devtools/dracut/dracut_git.bb
>> @@ -12,6 +12,7 @@ PV = "049"
>>   SRCREV = "225e4b94cbdb702cf512490dcd2ad9ca5f5b22c1"
>>   SRC_URI = "git://git.kernel.org/pub/scm/boot/dracut/dracut.git;protocol=http \
>>              file://0001-util.h-include-sys-reg.h-when-libc-glibc.patch \
>> +           file://execute_dracut \
>>              "
>>
>>   DEPENDS += "kmod"
>> @@ -49,11 +50,15 @@ do_install() {
>>       # Its Makefile uses cp -arx to install modules.d, so fix the owner
>>       # to root:root
>>       chown -R root:root ${D}/${prefix}/lib/dracut/modules.d
>> +
>> +    install -d -m0755 ${D}${datadir}/opkg/intercept
>> +    install -m0755 ${WORKDIR}/execute_dracut ${D}${datadir}/opkg/intercept
>>   }
>>
>>   FILES_${PN} += "${prefix}/lib/kernel \
>>                   ${prefix}/lib/dracut \
>>                   ${systemd_unitdir} \
>> +                ${datadir}/opkg/intercept \
>>                  "
>>   FILES_${PN}-dbg += "${prefix}/lib/dracut/.debug"
>>
>> --
>> 2.20.1
>>
> 



More information about the Openembedded-devel mailing list