Patchwork [5/5] buildroot: initramfs: Generate vmImage without builtin initramfs rootfs.

login
register
mail settings
Submitter Sonic Zhang
Date Aug. 7, 2012, 9:09 a.m.
Message ID <1344330577-25159-5-git-send-email-sonic.adi@gmail.com>
Download mbox | patch
Permalink /patch/175545/
State Rejected
Headers show

Comments

Sonic Zhang - Aug. 7, 2012, 9:09 a.m.
From: Sonic Zhang <sonic.zhang@analog.com>

This is for developer's convenience when debugging via initramfs uImage.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
---
 linux/linux.mk |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
Thomas Petazzoni - Aug. 11, 2012, 6:13 p.m.
Le Tue, 7 Aug 2012 17:09:37 +0800,
Sonic Zhang <sonic.adi@gmail.com> a écrit :

> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> This is for developer's convenience when debugging via initramfs uImage.
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

What is the problem being solved here? Could you expand a bit on the
"why" this is needed? When you make changes to the root filesystem and
do "make", the initramfs is regenerated, and the kernel image is
regenerated as well with the current Buildroot, so I'm not sure what
this patch is solving.

> +	$(if $(BR2_TARGET_ROOTFS_INITRAMFS),
> +		cp $(LINUX_IMAGE_PATH) $(KERNEL_ARCH_PATH)/boot/vmImage)

I'm confused. What is this vmImage thing that you are copying back into
the kernel tree here...

>  define LINUX_INSTALL_IMAGES_CMDS
>  	cp $(LINUX_IMAGE_PATH) $(BINARIES_DIR)
> +	$(if $(BR2_TARGET_ROOTFS_INITRAMFS),
> +		cp $(KERNEL_ARCH_PATH)/boot/vmImage $(BINARIES_DIR))

and installing to output/images here?

Thanks,

Thomas
Sonic Zhang - Aug. 13, 2012, 10:32 a.m.
On Sun, Aug 12, 2012 at 2:13 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Le Tue, 7 Aug 2012 17:09:37 +0800,
> Sonic Zhang <sonic.adi@gmail.com> a écrit :
>
>> From: Sonic Zhang <sonic.zhang@analog.com>
>>
>> This is for developer's convenience when debugging via initramfs uImage.
>>
>> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
>
> What is the problem being solved here? Could you expand a bit on the
> "why" this is needed? When you make changes to the root filesystem and
> do "make", the initramfs is regenerated, and the kernel image is
> regenerated as well with the current Buildroot, so I'm not sure what
> this patch is solving.

The uImage generated for initramfs can't be used directly to boot
kernel with a rootfs on the other device by setting boot parameters
"root=/dev/mtdblock0" in uboot. Some test cases need to boot from the
other device without rebuilding the uImage for initramfs.

This patch generates a pure kernel image (vmImage) for developers
convenience in addition to the uImage which has initramfs linked in.


Regards,

Sonic

>
>> +     $(if $(BR2_TARGET_ROOTFS_INITRAMFS),
>> +             cp $(LINUX_IMAGE_PATH) $(KERNEL_ARCH_PATH)/boot/vmImage)
>
> I'm confused. What is this vmImage thing that you are copying back into
> the kernel tree here...
>
>>  define LINUX_INSTALL_IMAGES_CMDS
>>       cp $(LINUX_IMAGE_PATH) $(BINARIES_DIR)
>> +     $(if $(BR2_TARGET_ROOTFS_INITRAMFS),
>> +             cp $(KERNEL_ARCH_PATH)/boot/vmImage $(BINARIES_DIR))
>
> and installing to output/images here?
>
> Thanks,
>
> Thomas
> --
> Thomas Petazzoni, Free Electrons
> Kernel, drivers, real-time and embedded Linux
> development, consulting, training and support.
> http://free-electrons.com
Arnout Vandecappelle - Aug. 21, 2012, 10:49 p.m.
On 08/13/12 12:32, Sonic Zhang wrote:
> This patch generates a pure kernel image (vmImage) for developers
> convenience in addition to the uImage which has initramfs linked in.

  This sentence makes a much clearer commit message :-)

  Also, I would call this image $(LINUX_IMAGE_NAME)-noinitramfs rather than
vmImage.

  Regards,
  Arnout

Patch

diff --git a/linux/linux.mk b/linux/linux.mk
index 4ad8b49..49545b8 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -223,6 +223,11 @@  endif
 # Compilation. We make sure the kernel gets rebuilt when the
 # configuration has changed.
 define LINUX_BUILD_CMDS
+	$(if $(BR2_TARGET_ROOTFS_INITRAMFS),
+	# Remove the any previously generated initramfs if do recompilation.
+		$(RM) -f $(BINARIES_DIR)/rootfs.initramfs
+		$(RM) -f $(@D)/usr/initramfs_data.cpio*
+		touch $(BINARIES_DIR)/rootfs.initramfs)
 	$(if $(BR2_LINUX_KERNEL_USE_CUSTOM_DTS),
 		cp $(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH) $(KERNEL_ARCH_PATH)/boot/dts/)
 	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_SOURCE_DIR) $(LINUX_IMAGE_TARGET)
@@ -231,6 +236,8 @@  define LINUX_BUILD_CMDS
 	fi
 	$(LINUX_BUILD_DTB)
 	$(LINUX_APPEND_DTB)
+	$(if $(BR2_TARGET_ROOTFS_INITRAMFS),
+		cp $(LINUX_IMAGE_PATH) $(KERNEL_ARCH_PATH)/boot/vmImage)
 endef
 
 
@@ -251,6 +258,8 @@  endef
 
 define LINUX_INSTALL_IMAGES_CMDS
 	cp $(LINUX_IMAGE_PATH) $(BINARIES_DIR)
+	$(if $(BR2_TARGET_ROOTFS_INITRAMFS),
+		cp $(KERNEL_ARCH_PATH)/boot/vmImage $(BINARIES_DIR))
 endef
 
 define LINUX_INSTALL_TARGET_CMDS