All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jérôme Pouiller" <jezz@sysmic.org>
To: buildroot@busybox.net
Subject: [Buildroot] How transfer what image(s) to target-CF?
Date: Mon, 28 Apr 2014 16:25:21 +0200	[thread overview]
Message-ID: <5293482.NlRU5sky3t@sagittea> (raw)
In-Reply-To: <CAEzGmjByYAXYo2bbnKqRcu4nzJfjbEz8ZsaiB_MdSNQgDs2M3Q@mail.gmail.com>

On Monday 28 April 2014 14:33:19 Lennart Ramberg wrote:
> On Sun, Apr 27, 2014 at 9:39 PM, Bj?rn Kirchner <bjoern@am-soft.de> wrote:
> > The instructions refered to grub-legacy. I thougt you would use
> > grub-legacy because you wrote you could not select grub2.
> > In buildroot 2013.08 there is a /sbin/grub in the rootfs image,
> > if in the .config "BR2_TARGET_GRUB=y" is set. But there is no
> > "BR2_TARGET_GRUB_FS_EXT2" in my .config.
> 
> Hi Bj?rn,
> Yes, I am talking about grub-legacy only.
> 
> Maybe I should wait for grub2. Is that to be expected in the next stable
> release, anyone?

I did not check how it work exactly with grub-legacy. However, I can 
give you my recipe to get full disk image using grub2:

 * First cherry-pick c24fdb3 to get support of grub2 (I also work in 
   2014.02 and I had no problem to backport this commit)

 * Select BR2_PACKAGE_HOST_GENIMAGE, BR2_TARGET_GRUB2 and 
   BR2_TARGET_ROOTFS_EXT2 in your configuration

 * Add a boot/grub/grub.cfg to your overlay (you may also embed it in 
   grub, but i have some issues with that)

 * Add a configuration file for host-genimage:

genimage.cfg:
-----------8<--------------------------------8<------------------------
image hdimg.img {
        hdimage {
                align = 1M
        }
        partition boot {
                in-partition-table = "no"
                image = "boot.img"
                offset = 0
                size = 512
        }
        partition grub {
                 in-partition-table = "no"
                 image = "grub.img"
                 offset = 512
        }
        partition root {
                # size = 1G
                partition-type = 0x83
                image = "rootfs.ext2"
        }
}

config {
        outputpath = images
        inputpath = images
        #rootpath = target
        rootpath = empty
        tmppath = tmp
}
---------->8------------------------------->8--------------------------

  * Add a BR2_ROOTFS_POST_IMAGE_SCRIPT to create boot.img, grub.img[1] 
and final image:

postimage.sh:
-----------8<--------------------------------8<------------------------
#!/bin/bash

BOARD_DIR=$(dirname $(readlink -f $0))
IMAGE_DIR=$(readlink -f $1)
HOST_DIR=$(readlink -f $2)
PATH=$HOST_DIR/usr/bin:$HOST_DIR/host/usr/sbin:$PATH

cp $HOST_DIR/usr/lib/grub/i386-pc/boot.img $IMAGE_DIR
grub-mkimage -d $HOST_DIR/usr/lib/grub/i386-pc -O i386-pc -o 
$IMAGE_DIR/grub.img -p "(hd0,msdos1)/boot/grub" boot linux ext2 fat part_msdos 
normal biosdisk help ls minicmd serial

pushd $IMAGE_DIR/..
  mkdir -p empty
  genimage --config $BOARD_DIR/genimage.cfg || exit 1
popd
---------->8------------------------------->8--------------------------

 * In order to pass path of boot.img to this script, you also have to 
    set BR2_ROOTFS_POST_SCRIPT_ARGS="$(HOST_DIR)"


[1] Buildroot automatically generate grub.img. However, it looks like 
it is necessary to force a specific prefix (-p option) in order to have 
a bootable image.

-- 
J?r?me Pouiller, Sysmic
Embedded Linux specialist
http://www.sysmic.fr

  reply	other threads:[~2014-04-28 14:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-23 13:42 [Buildroot] How transfer what image(s) to target-CF? Lennart Ramberg
2014-04-23 15:33 ` Arnout Vandecappelle
2014-04-24 10:07   ` Lennart Ramberg
2014-04-24 21:44     ` Arnout Vandecappelle
2014-04-25 18:37       ` Lennart Ramberg
2014-04-25 18:53         ` Arnout Vandecappelle
2014-04-25 21:42           ` Lennart Ramberg
2014-04-26  7:23             ` Björn Kirchner
2014-04-27 16:37               ` Lennart Ramberg
2014-04-27 19:39                 ` Björn Kirchner
2014-04-28 12:33                   ` Lennart Ramberg
2014-04-28 14:25                     ` Jérôme Pouiller [this message]
     [not found]                     ` <25917145.tTrImWgKe2@sagittea>
2014-04-28 14:27                       ` Jérôme Pouiller
2014-05-05  9:01                         ` Lennart Ramberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5293482.NlRU5sky3t@sagittea \
    --to=jezz@sysmic.org \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.