All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Using buildroot images (iso/ext2) in real target device (flash drive)
@ 2012-03-01 16:06 Willy
  2012-03-01 16:59 ` Thomas Petazzoni
  2012-04-24 13:04 ` Willy
  0 siblings, 2 replies; 8+ messages in thread
From: Willy @ 2012-03-01 16:06 UTC (permalink / raw)
  To: buildroot

Hi,
I have created my system images (iso and ext2) and I would put one of 
them in the flash drive of the target system.

So far I've used unetbootin to create a bootable system which loaded in 
RAM, now the image is too big for my RAM.

Now I've used dd to put my image in the flash drive:
sudo dd if=rootfs.ext2 of=/dev/sdc1

Then when the machine starts I got the error:

Missing operating system
DISK BOOT FAILURE, PLEASE INSERT...

I "think" I've installed grub on my buildroot image
( package BR2_TARGET_GRUB [=y] ).
How can I test if grub is properly installed and how can I setup it?
Thanks,
-- 
Willy

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

* [Buildroot] Using buildroot images (iso/ext2) in real target device (flash drive)
  2012-03-01 16:06 [Buildroot] Using buildroot images (iso/ext2) in real target device (flash drive) Willy
@ 2012-03-01 16:59 ` Thomas Petazzoni
  2012-03-02 23:00   ` Arnout Vandecappelle
  2012-04-24 13:04 ` Willy
  1 sibling, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2012-03-01 16:59 UTC (permalink / raw)
  To: buildroot

Le Thu, 01 Mar 2012 17:06:44 +0100,
Willy <willy@willygroup.org> a ?crit :

> I have created my system images (iso and ext2) and I would put one of 
> them in the flash drive of the target system.
> 
> So far I've used unetbootin to create a bootable system which loaded
> in RAM, now the image is too big for my RAM.
> 
> Now I've used dd to put my image in the flash drive:
> sudo dd if=rootfs.ext2 of=/dev/sdc1
> 
> Then when the machine starts I got the error:
> 
> Missing operating system
> DISK BOOT FAILURE, PLEASE INSERT...

Yes, you need a bootloader.

> I "think" I've installed grub on my buildroot image
> ( package BR2_TARGET_GRUB [=y] ).
> How can I test if grub is properly installed and how can I setup it?

You need to run grub so that it installs itself on your /dev/sdc
device. Something like:

printf "device (hd0) /dev/sdc\nroot (hd0,0)\nsetup (hd0)\nquit\n" | output/staging/sbin/grub --device-map=/dev/null --no-floppy

Let us know if that works. We should certainly extend the documentation
with more details about this.

Best regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] Using buildroot images (iso/ext2) in real target device (flash drive)
  2012-03-01 16:59 ` Thomas Petazzoni
@ 2012-03-02 23:00   ` Arnout Vandecappelle
  2012-03-03 19:52     ` PHilip RUshik
  2012-03-05  9:45     ` Thomas Petazzoni
  0 siblings, 2 replies; 8+ messages in thread
From: Arnout Vandecappelle @ 2012-03-02 23:00 UTC (permalink / raw)
  To: buildroot

On Thursday 01 March 2012 16:59:21 Thomas Petazzoni wrote:
> You need to run grub so that it installs itself on your /dev/sdc
> device. Something like:
> 
> printf "device (hd0) /dev/sdc\nroot (hd0,0)\nsetup (hd0)\nquit\n" | output/staging/sbin/grub --device-map=/dev/null --no-floppy
> 
> Let us know if that works. We should certainly extend the documentation
> with more details about this.

 It probably won't work if your target is uclibc-based (unless your host
happens to be uclibc-based as well :-).  You'd need a host-grub to get
that right.  I tried to do that half a year ago, but it wasn't so easy -
unfortunately I don't remember why not.  Could be a problem with 32/64 bit.
Or with ccache.

 Regards,
 Arnout


-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

* [Buildroot] Using buildroot images (iso/ext2) in real target device (flash drive)
  2012-03-02 23:00   ` Arnout Vandecappelle
@ 2012-03-03 19:52     ` PHilip RUshik
  2012-03-05  9:45     ` Thomas Petazzoni
  1 sibling, 0 replies; 8+ messages in thread
From: PHilip RUshik @ 2012-03-03 19:52 UTC (permalink / raw)
  To: buildroot

On Sat, Mar 3, 2012 at 8:00 AM, Arnout Vandecappelle <arnout@mind.be> wrote:

> On Thursday 01 March 2012 16:59:21 Thomas Petazzoni wrote:
> > You need to run grub so that it installs itself on your /dev/sdc
> > device. Something like:
> >
> > printf "device (hd0) /dev/sdc\nroot (hd0,0)\nsetup (hd0)\nquit\n" |
> output/staging/sbin/grub --device-map=/dev/null --no-floppy
> >
> > Let us know if that works. We should certainly extend the documentation
> > with more details about this.
>
>  It probably won't work if your target is uclibc-based (unless your host
> happens to be uclibc-based as well :-).  You'd need a host-grub to get
> that right.  I tried to do that half a year ago, but it wasn't so easy -
> unfortunately I don't remember why not.  Could be a problem with 32/64 bit.
> Or with ccache.
>

What you could do is use qemu to get your bootloader installed. I typically
use lilo for uclibc images, so I don't know the exact commands, but
basically get the grub source code or binary on your image, then copy the
kernel and initrd (if you have one) onto you host system, then start qemu
using your flash drive as qemu's hard drive and use the -kernel and -append
options on qemu. Then once it boots and you log in, just install grub as
you would if you were installing it on your hard drive, since qemu will
make it look like your flash drive is a hard drive.

the command to star qemu would look something like this:
qemu-system-x86_64 -kernel ./vmlinux -append "root=/dev/sda1" -hda /dev/sdc

make sure /dev/sdc* is NOT mounted anywhere else when you do this or else
it could get corrupted pretty bad.



 --PHil

I'm sending it to the mailing list this time :-P
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120304/ef9a9bec/attachment.html>

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

* [Buildroot] Using buildroot images (iso/ext2) in real target device (flash drive)
  2012-03-02 23:00   ` Arnout Vandecappelle
  2012-03-03 19:52     ` PHilip RUshik
@ 2012-03-05  9:45     ` Thomas Petazzoni
  1 sibling, 0 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2012-03-05  9:45 UTC (permalink / raw)
  To: buildroot

Le Fri, 2 Mar 2012 23:00:01 +0000,
Arnout Vandecappelle <arnout@mind.be> a ?crit :

>  It probably won't work if your target is uclibc-based (unless your host
> happens to be uclibc-based as well :-).

Correct. This code was taken from a project that was glibc-based.

> You'd need a host-grub to get that right.  I tried to do that half a year ago, but it wasn't so easy -
> unfortunately I don't remember why not.  Could be a problem with 32/64 bit.
> Or with ccache.

Yeah, I remember you posted some patches about this. Don't remember
what the outcome was, though. Definitely something that would be nice
to improve.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

* [Buildroot] Using buildroot images (iso/ext2) in real target device (flash drive)
  2012-03-01 16:06 [Buildroot] Using buildroot images (iso/ext2) in real target device (flash drive) Willy
  2012-03-01 16:59 ` Thomas Petazzoni
@ 2012-04-24 13:04 ` Willy
  2012-04-27 14:23   ` Willy
  1 sibling, 1 reply; 8+ messages in thread
From: Willy @ 2012-04-24 13:04 UTC (permalink / raw)
  To: buildroot

Il 01/03/2012 17:06, Willy ha scritto:
> I "think" I've installed grub on my buildroot image
> ( package BR2_TARGET_GRUB [=y] ).
> How can I test if grub is properly installed and how can I setup it?
> Thanks,

I've still that problem :-(

Here what I do:
1. make buildroot with grub selected and iso/etx2/tar image
2. create an ext2 partition (with boot flag) in my usb key with gparted
3. use dd to put the ext2 fs in my key: dd if=rootfs.ext2 of=/dev/sdc1
	this put the fs in my key, but It say that only 11MB are
	avaiable, so I use gparted again to resize the partition and
	magically the dimension is correct!
4. put bzImage in the buildroot fs folder /boot
5. using qemu with -hda option to load buildroot and install grub in 
/dev/sdc1

When in grub (image booted with qemu) give the command setup (hd0) I got 
a segmentation fault.
Somewhere I found that there is a problem with a patch for grub (sorry, 
I don't remember exactly the name ...inode...ext2...) but I can't find 
this patch.

So I've downloaded grub sources and put them into my filesystem.
Then I've compiled grub into qemu virtualization (modifying arguments 
for the ar command in Makefiles from cru to cr) and then I've installed 
grub on the device hd0.
I've created a menu.lst file manually:
#########################################
default		0
timeout		10
color light-green/brown blink-red/blue

title		BuildRoot ISO9660 image
kernel		/boot/bzImage root=/dev/hda1
#########################################

Now when I try to boot with this key usb, briefly read "Grub loading..." 
then there is a reboot.

-- 
Willy

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

* [Buildroot] Using buildroot images (iso/ext2) in real target device (flash drive)
  2012-04-24 13:04 ` Willy
@ 2012-04-27 14:23   ` Willy
  2012-04-27 20:37     ` Arnout Vandecappelle
  0 siblings, 1 reply; 8+ messages in thread
From: Willy @ 2012-04-27 14:23 UTC (permalink / raw)
  To: buildroot

Il 24/04/2012 15:04, Willy ha scritto:
> I've still that problem :-(

I made some little steps.

I've installed grub on my usb flash using qemu:
"qemu -kernel bzimage -hda=/dev/sdc"
where sdc is my usb flash.
It tries to boot, but it stops.
I figured out that it tries to boot the bzImage on RAM (and it's larger 
than my memory).

So I've deleted the output/ folder, made some modifications and rebuilt 
all obtaining a smaller kernel and a smaller fs.
Now it boot, but always using the bzImage (I've only /boot/grub/* and 
bzImage on my flash usb). Every modifications does not survive to reboot.

So I've built the vmlinux image and tar fs, but I got
"Grub Error 13: Invalid or unsupported executable format"

There is a way to use a vmlinux image and the fs directly on the flash 
drive?

Thanks
-- 
Willy

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

* [Buildroot] Using buildroot images (iso/ext2) in real target device (flash drive)
  2012-04-27 14:23   ` Willy
@ 2012-04-27 20:37     ` Arnout Vandecappelle
  0 siblings, 0 replies; 8+ messages in thread
From: Arnout Vandecappelle @ 2012-04-27 20:37 UTC (permalink / raw)
  To: buildroot

On Friday 27 April 2012 16:23:20 Willy wrote:
> So I've deleted the output/ folder, made some modifications and rebuilt 
> all obtaining a smaller kernel and a smaller fs.
> Now it boot, but always using the bzImage (I've only /boot/grub/* and 
> bzImage on my flash usb). 

 So where did the rest of your rootfs.ext2 go?  

> Every modifications does not survive to reboot.

 Maybe you changed the rootfs to an initramfs?


> So I've built the vmlinux image and tar fs, but I got
> "Grub Error 13: Invalid or unsupported executable format"

 vmlinux is not executable by grub, and a tar file is not readable
by the kernel.


 The proper approach is the following:

- Create a /boot/grub/menu.lst in your rootfs skeleton.

- Make sure you have the grub boot loader configured.

- Build kernel and rootfs.ext2.  Make sure BR2_LINUX_KERNEL_INSTALL_TARGET
is selected, so the kernel is inside the rootfs.ext2.  If you want extra
space in your rootfs to write files to it, set the 
BR2_TARGET_ROOTFS_EXT2_BLOCKS variable to the size of the root partition.
Note, though, that genext2fs creates that whole size in memory, so you
need to have enough RAM.

- Write rootfs.ext2 to the root partition: 'cat rootfs.ext2 > /dev/hdc1'

- Run 'grub --device-map=/dev/null --no-floppy' and give the following 
commands interactively:

device (hd0) /dev/hdc
root (hd0,0)
setup (hd0)
quit

This installs grub on /dev/hdc and makes it bootable.


 Regards,
 Arnout


-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

end of thread, other threads:[~2012-04-27 20:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-01 16:06 [Buildroot] Using buildroot images (iso/ext2) in real target device (flash drive) Willy
2012-03-01 16:59 ` Thomas Petazzoni
2012-03-02 23:00   ` Arnout Vandecappelle
2012-03-03 19:52     ` PHilip RUshik
2012-03-05  9:45     ` Thomas Petazzoni
2012-04-24 13:04 ` Willy
2012-04-27 14:23   ` Willy
2012-04-27 20:37     ` Arnout Vandecappelle

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.