All of lore.kernel.org
 help / color / mirror / Atom feed
* Qemu+busybox for kernel development
@ 2017-06-28  8:46 Alexander Kapshuk
  2017-06-28 16:34 ` Ben Mezger
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alexander Kapshuk @ 2017-06-28  8:46 UTC (permalink / raw)
  To: kernelnewbies

I am trying to setup a build environment where I can run the kernel and see
how the changes I have made to the kernel source work.
My understanding, based on googling, is that it is common practice in the
kernel community to use a virtualised environment for that purpose.
What I have done so far is create a ramfs that is built into the kernel, as
described here [1] and here [2].

[1] https://landley.net/writing/rootfs-howto.html
[2]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/early-userspace/README?h=v4.12-rc7

a). I have generated a minimal initramfs_list file:
scripts/gen_initramfs_list.sh -d >usr/initramfs_list
Which looks like this:
# This is a very simple, default initramfs

dir /dev 0755 0 0
nod /dev/console 0600 0 0 c 5 1
dir /root 0700 0 0
# file /kinit usr/kinit/kinit 0755 0 0
# slink /init kinit 0755 0 0
slink /bin/sh busybox 777 0 0
file /init /bin/busybox 755 0 0

b). Set CONFIG_INITRAMFS_SOURCE:
CONFIG_INITRAMFS_SOURCE="/home/sasha/linux/usr/initramfs_list"

c). And had the kernel generate the initramfs image:
make
...
GEN     usr/initramfs_data.cpio.gz
  CHK     include/generated/compile.h
  AS      usr/initramfs_data.o
  LD      usr/built-in.o
...

When I run the kernel in qemu I get an error message which complains about
/etc/init.d/rcS missing.
The posts online seem to suggest that this has got to do with the busybox
configuration.
So far, I have not been able to get my head around this problem.
Any points or suggestions would be much appreciated.

Alexander Kapshuk.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170628/c1138e1c/attachment.html 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Qemu+busybox for kernel development
  2017-06-28  8:46 Qemu+busybox for kernel development Alexander Kapshuk
@ 2017-06-28 16:34 ` Ben Mezger
  2017-06-28 19:48 ` Shahbaz khan
  2017-07-02 20:44 ` Alice Ferrazzi
  2 siblings, 0 replies; 5+ messages in thread
From: Ben Mezger @ 2017-06-28 16:34 UTC (permalink / raw)
  To: kernelnewbies

The way I do it is by compiling the kernel as I would normaly do for a
real system.
Then, after copying vmlinuz and generating my initramfs, I run Qemu:

$ qemu-system-x86_64 -kernel vmlinuz -initrd initramfs.img -append
param1=value1

For me, as I am mostly testing, there is no need for a full-feature root
FS, since initramfs is perfect for containing small test application and
loadable kernel modules.

This might come in hand, though: https://lwn.net/Articles/660404/

On 06/28/2017 05:46 AM, Alexander Kapshuk wrote:
> I am trying to setup a build environment where I can run the kernel and
> see how the changes I have made to the kernel source work.
> My understanding, based on googling, is that it is common practice in
> the kernel community to use a virtualised environment for that purpose.
> What I have done so far is create a ramfs that is built into the kernel,
> as described here [1] and here [2].
> 
> [1] https://landley.net/writing/rootfs-howto.html
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/early-userspace/README?h=v4.12-rc7
> 
> a). I have generated a minimal initramfs_list file:
> scripts/gen_initramfs_list.sh -d >usr/initramfs_list
> Which looks like this:
> # This is a very simple, default initramfs
> 
> dir /dev 0755 0 0
> nod /dev/console 0600 0 0 c 5 1
> dir /root 0700 0 0
> # file /kinit usr/kinit/kinit 0755 0 0
> # slink /init kinit 0755 0 0
> slink /bin/sh busybox 777 0 0
> file /init /bin/busybox 755 0 0
> 
> b). Set CONFIG_INITRAMFS_SOURCE:
> CONFIG_INITRAMFS_SOURCE="/home/sasha/linux/usr/initramfs_list"
> 
> c). And had the kernel generate the initramfs image:
> make
> ...
> GEN     usr/initramfs_data.cpio.gz
>   CHK     include/generated/compile.h
>   AS      usr/initramfs_data.o
>   LD      usr/built-in.o
> ...
> 
> When I run the kernel in qemu I get an error message which complains
> about /etc/init.d/rcS missing.
> The posts online seem to suggest that this has got to do with the
> busybox configuration.
> So far, I have not been able to get my head around this problem.
> Any points or suggestions would be much appreciated.
> 
> Alexander Kapshuk.
> 
> 
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 

-- 
- seds
~> https://seds.nl

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Qemu+busybox for kernel development
  2017-06-28  8:46 Qemu+busybox for kernel development Alexander Kapshuk
  2017-06-28 16:34 ` Ben Mezger
@ 2017-06-28 19:48 ` Shahbaz khan
  2017-07-02 19:45   ` Alexander Kapshuk
  2017-07-02 20:44 ` Alice Ferrazzi
  2 siblings, 1 reply; 5+ messages in thread
From: Shahbaz khan @ 2017-06-28 19:48 UTC (permalink / raw)
  To: kernelnewbies

Hi Alexander,

On Wed, Jun 28, 2017 at 1:46 PM, Alexander Kapshuk <
alexander.kapshuk@gmail.com> wrote:

> I am trying to setup a build environment where I can run the kernel and
> see how the changes I have made to the kernel source work.
> My understanding, based on googling, is that it is common practice in the
> kernel community to use a virtualised environment for that purpose.
> What I have done so far is create a ramfs that is built into the kernel,
> as described here [1] and here [2].
>
> [1] https://landley.net/writing/rootfs-howto.html
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/
> torvalds/linux.git/plain/Documentation/early-userspace/README?h=v4.12-rc7
>
> a). I have generated a minimal initramfs_list file:
> scripts/gen_initramfs_list.sh -d >usr/initramfs_list
> Which looks like this:
> # This is a very simple, default initramfs
>
> dir /dev 0755 0 0
> nod /dev/console 0600 0 0 c 5 1
> dir /root 0700 0 0
> # file /kinit usr/kinit/kinit 0755 0 0
> # slink /init kinit 0755 0 0
> slink /bin/sh busybox 777 0 0
> file /init /bin/busybox 755 0 0
>
> b). Set CONFIG_INITRAMFS_SOURCE:
> CONFIG_INITRAMFS_SOURCE="/home/sasha/linux/usr/initramfs_list"
>
> c). And had the kernel generate the initramfs image:
> make
> ...
> GEN     usr/initramfs_data.cpio.gz
>   CHK     include/generated/compile.h
>   AS      usr/initramfs_data.o
>   LD      usr/built-in.o
> ...
>
> When I run the kernel in qemu I get an error message which complains about
> /etc/init.d/rcS missing.
>

Did you check initramfs for rc.S script?

The kernel configuration, busybox configuration and the layout of initramfs
(which should be /home/sasha/linux/usr/initramfs_list) should be
consistent. If the kernel is asking for it then it is not consistent.


> The posts online seem to suggest that this has got to do with the busybox
> configuration.
> So far, I have not been able to get my head around this problem.
> Any points or suggestions would be much appreciated.
>
> Alexander Kapshuk.
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>

Thank you.
Shahbaz Khan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170629/a8a3f6d9/attachment-0001.html 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Qemu+busybox for kernel development
  2017-06-28 19:48 ` Shahbaz khan
@ 2017-07-02 19:45   ` Alexander Kapshuk
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Kapshuk @ 2017-07-02 19:45 UTC (permalink / raw)
  To: kernelnewbies

On Wed, Jun 28, 2017 at 10:48 PM, Shahbaz khan <shazalive@gmail.com> wrote:
> Hi Alexander,
>
> On Wed, Jun 28, 2017 at 1:46 PM, Alexander Kapshuk
> <alexander.kapshuk@gmail.com> wrote:
>>
>> I am trying to setup a build environment where I can run the kernel and
>> see how the changes I have made to the kernel source work.
>> My understanding, based on googling, is that it is common practice in the
>> kernel community to use a virtualised environment for that purpose.
>> What I have done so far is create a ramfs that is built into the kernel,
>> as described here [1] and here [2].
>>
>> [1] https://landley.net/writing/rootfs-howto.html
>> [2]
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/early-userspace/README?h=v4.12-rc7
>>
>> a). I have generated a minimal initramfs_list file:
>> scripts/gen_initramfs_list.sh -d >usr/initramfs_list
>> Which looks like this:
>> # This is a very simple, default initramfs
>>
>> dir /dev 0755 0 0
>> nod /dev/console 0600 0 0 c 5 1
>> dir /root 0700 0 0
>> # file /kinit usr/kinit/kinit 0755 0 0
>> # slink /init kinit 0755 0 0
>> slink /bin/sh busybox 777 0 0
>> file /init /bin/busybox 755 0 0
>>
>> b). Set CONFIG_INITRAMFS_SOURCE:
>> CONFIG_INITRAMFS_SOURCE="/home/sasha/linux/usr/initramfs_list"
>>
>> c). And had the kernel generate the initramfs image:
>> make
>> ...
>> GEN     usr/initramfs_data.cpio.gz
>>   CHK     include/generated/compile.h
>>   AS      usr/initramfs_data.o
>>   LD      usr/built-in.o
>> ...
>>
>> When I run the kernel in qemu I get an error message which complains about
>> /etc/init.d/rcS missing.
>
>
> Did you check initramfs for rc.S script?
>
> The kernel configuration, busybox configuration and the layout of initramfs
> (which should be /home/sasha/linux/usr/initramfs_list) should be consistent.
> If the kernel is asking for it then it is not consistent.
>
>>
>> The posts online seem to suggest that this has got to do with the busybox
>> configuration.
>> So far, I have not been able to get my head around this problem.
>> Any points or suggestions would be much appreciated.
>>
>> Alexander Kapshuk.
>>
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
>
> Thank you.
> Shahbaz Khan

Apologies for the delay in replying.

Thanks very much for all of your responses. I'll give them all a try.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Qemu+busybox for kernel development
  2017-06-28  8:46 Qemu+busybox for kernel development Alexander Kapshuk
  2017-06-28 16:34 ` Ben Mezger
  2017-06-28 19:48 ` Shahbaz khan
@ 2017-07-02 20:44 ` Alice Ferrazzi
  2 siblings, 0 replies; 5+ messages in thread
From: Alice Ferrazzi @ 2017-07-02 20:44 UTC (permalink / raw)
  To: kernelnewbies

On Wed, Jun 28, 2017 at 5:46 PM, Alexander Kapshuk
<alexander.kapshuk@gmail.com> wrote:
> I am trying to setup a build environment where I can run the kernel and see
> how the changes I have made to the kernel source work.
> My understanding, based on googling, is that it is common practice in the
> kernel community to use a virtualised environment for that purpose.
> What I have done so far is create a ramfs that is built into the kernel, as
> described here [1] and here [2].
>
> [1] https://landley.net/writing/rootfs-howto.html
> [2]
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/early-userspace/README?h=v4.12-rc7
>
> a). I have generated a minimal initramfs_list file:
> scripts/gen_initramfs_list.sh -d >usr/initramfs_list
> Which looks like this:
> # This is a very simple, default initramfs
>
> dir /dev 0755 0 0
> nod /dev/console 0600 0 0 c 5 1
> dir /root 0700 0 0
> # file /kinit usr/kinit/kinit 0755 0 0
> # slink /init kinit 0755 0 0
> slink /bin/sh busybox 777 0 0
> file /init /bin/busybox 755 0 0
>
> b). Set CONFIG_INITRAMFS_SOURCE:
> CONFIG_INITRAMFS_SOURCE="/home/sasha/linux/usr/initramfs_list"
>
> c). And had the kernel generate the initramfs image:
> make
> ...
> GEN     usr/initramfs_data.cpio.gz
>   CHK     include/generated/compile.h
>   AS      usr/initramfs_data.o
>   LD      usr/built-in.o
> ...
>
> When I run the kernel in qemu I get an error message which complains about
> /etc/init.d/rcS missing.
> The posts online seem to suggest that this has got to do with the busybox
> configuration.
> So far, I have not been able to get my head around this problem.
> Any points or suggestions would be much appreciated.
>

We are using this in Gentoo for testing the kernel:
https://github.com/gentoo/Gentoo_kernelCI

This is how we are calling Qemu:
https://github.com/gentoo/Gentoo_kernelCI/blob/master/files/qemu_check.py#L50


-- 
Thanks,
Alice Ferrazzi

Gentoo Kernel Project Leader
Mail: Alice Ferrazzi <alice.ferrazzi@gmail.com>
PGP: 2E4E 0856 461C 0585 1336 F496 5621 A6B2 8638 781A

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-02 20:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-28  8:46 Qemu+busybox for kernel development Alexander Kapshuk
2017-06-28 16:34 ` Ben Mezger
2017-06-28 19:48 ` Shahbaz khan
2017-07-02 19:45   ` Alexander Kapshuk
2017-07-02 20:44 ` Alice Ferrazzi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.