* [PATCH V2 1/2] kernel.bbclass: move bundle_initramfs after kernel_link_vmlinux
@ 2013-11-13 3:14 Ming Liu
2013-11-13 3:14 ` [PATCH V2 2/2] kernel.bbclass: handles symbolic KERNEL_OUTPUT in bundle_initramfs task Ming Liu
0 siblings, 1 reply; 3+ messages in thread
From: Ming Liu @ 2013-11-13 3:14 UTC (permalink / raw)
To: openembedded-core
${KERNEL_OUTPUT} is being renamed/restored in bundle_initramfs task, so we
must ensure bundle_initramfs run after kernel_link_vmlinux where the link
of vmlinux is created as the bootable image.
Signed-off-by: Ming Liu <ming.liu@windriver.com>
---
meta/classes/kernel.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index a4db9f5..966066f 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -152,7 +152,7 @@ python do_devshell_prepend () {
os.environ["LDFLAGS"] = ''
}
-addtask bundle_initramfs after do_compile before do_build
+addtask bundle_initramfs after do_kernel_link_vmlinux before do_build
kernel_do_compile() {
unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
--
1.8.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH V2 2/2] kernel.bbclass: handles symbolic KERNEL_OUTPUT in bundle_initramfs task
2013-11-13 3:14 [PATCH V2 1/2] kernel.bbclass: move bundle_initramfs after kernel_link_vmlinux Ming Liu
@ 2013-11-13 3:14 ` Ming Liu
2013-11-13 5:29 ` Ming Liu
0 siblings, 1 reply; 3+ messages in thread
From: Ming Liu @ 2013-11-13 3:14 UTC (permalink / raw)
To: openembedded-core
In many cases, KERNEL_OUTPUT is a symbolic link to the real bootable image,
but in bundle_initramfs task, it's not considered so that the KERNEL_OUTPUT
is being renamed/restored as a regular file, this leads it finally point to
a incorrect target, or even worse, break the bundle_initramfs task for
KERNEL_OUTPUT is not going to be regenerated in case it is a symbolic link
to vmlinux.
Signed-off-by: Ming Liu <ming.liu@windriver.com>
---
meta/classes/kernel.bbclass | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 966066f..ce987a5 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -123,13 +123,28 @@ do_bundle_initramfs () {
if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
echo "Creating a kernel image with a bundled initramfs..."
copy_initramfs
- if [ -e ${KERNEL_OUTPUT} ] ; then
+ # Backuping kernel image relies on its type(regular file or symbolic link)
+ linkpath=""
+ realpath=""
+ if [ -h ${KERNEL_OUTPUT} ] ; then
+ linkpath=`readlink -n ${KERNEL_OUTPUT}`
+ realpath=`readlink -fn ${KERNEL_OUTPUT}`
+ mv -f $realpath $realpath.bak
+ elif [ -f ${KERNEL_OUTPUT} ]; then
mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.bak
fi
use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
kernel_do_compile
- mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.initramfs
- mv -f ${KERNEL_OUTPUT}.bak ${KERNEL_OUTPUT}
+ # Restoring kernel image
+ if [ -n $realpath ]; then
+ mv -f $realpath $realpath.initramfs
+ mv -f $realpath.bak $realpath
+ cd ${B}/$(dirname ${KERNEL_OUTPUT})
+ ln -sf $linkpath.initramfs
+ else
+ mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.initramfs
+ mv -f ${KERNEL_OUTPUT}.bak ${KERNEL_OUTPUT}
+ fi
# Update install area
echo "There is kernel image bundled with initramfs: ${B}/${KERNEL_OUTPUT}.initramfs"
install -m 0644 ${B}/${KERNEL_OUTPUT}.initramfs ${D}/boot/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin
--
1.8.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH V2 2/2] kernel.bbclass: handles symbolic KERNEL_OUTPUT in bundle_initramfs task
2013-11-13 3:14 ` [PATCH V2 2/2] kernel.bbclass: handles symbolic KERNEL_OUTPUT in bundle_initramfs task Ming Liu
@ 2013-11-13 5:29 ` Ming Liu
0 siblings, 0 replies; 3+ messages in thread
From: Ming Liu @ 2013-11-13 5:29 UTC (permalink / raw)
To: openembedded-core
On 11/13/2013 11:14 AM, Ming Liu wrote:
> In many cases, KERNEL_OUTPUT is a symbolic link to the real bootable image,
> but in bundle_initramfs task, it's not considered so that the KERNEL_OUTPUT
> is being renamed/restored as a regular file, this leads it finally point to
> a incorrect target, or even worse, break the bundle_initramfs task for
> KERNEL_OUTPUT is not going to be regenerated in case it is a symbolic link
> to vmlinux.
>
> Signed-off-by: Ming Liu <ming.liu@windriver.com>
> ---
> meta/classes/kernel.bbclass | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 966066f..ce987a5 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -123,13 +123,28 @@ do_bundle_initramfs () {
> if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
> echo "Creating a kernel image with a bundled initramfs..."
> copy_initramfs
> - if [ -e ${KERNEL_OUTPUT} ] ; then
> + # Backuping kernel image relies on its type(regular file or symbolic link)
> + linkpath=""
> + realpath=""
> + if [ -h ${KERNEL_OUTPUT} ] ; then
> + linkpath=`readlink -n ${KERNEL_OUTPUT}`
> + realpath=`readlink -fn ${KERNEL_OUTPUT}`
> + mv -f $realpath $realpath.bak
> + elif [ -f ${KERNEL_OUTPUT} ]; then
> mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.bak
> fi
> use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
> kernel_do_compile
> - mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.initramfs
> - mv -f ${KERNEL_OUTPUT}.bak ${KERNEL_OUTPUT}
> + # Restoring kernel image
> + if [ -n $realpath ]; then
I made a mistake here, $realpath need to be quoted, otherwise, it will
break the task while $realpath is empty. So I need send a V3.
//Ming Liu
> + mv -f $realpath $realpath.initramfs
> + mv -f $realpath.bak $realpath
> + cd ${B}/$(dirname ${KERNEL_OUTPUT})
> + ln -sf $linkpath.initramfs
> + else
> + mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.initramfs
> + mv -f ${KERNEL_OUTPUT}.bak ${KERNEL_OUTPUT}
> + fi
> # Update install area
> echo "There is kernel image bundled with initramfs: ${B}/${KERNEL_OUTPUT}.initramfs"
> install -m 0644 ${B}/${KERNEL_OUTPUT}.initramfs ${D}/boot/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-13 5:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-13 3:14 [PATCH V2 1/2] kernel.bbclass: move bundle_initramfs after kernel_link_vmlinux Ming Liu
2013-11-13 3:14 ` [PATCH V2 2/2] kernel.bbclass: handles symbolic KERNEL_OUTPUT in bundle_initramfs task Ming Liu
2013-11-13 5:29 ` Ming Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox