diff mbox

[v2] configs: add RaspberryPi defconfig

Message ID 1357910250-31110-1-git-send-email-maxime.hadjinlian@gmail.com
State Superseded
Headers show

Commit Message

Maxime Hadjinlian Jan. 11, 2013, 1:17 p.m. UTC
This is a default configuration for the RaspberryPi, tested and functionnal.

The kernel used is the one developped by the RaspberryPi foundation as it's not
fully supported currently in mainline kernel.
The configuration used for the kernel is the default bcmrpi.

Note that the kernel generated is a zImage but to work you should :
    - Rename it to kernel.img
    - Add 'kernel=zImage' in config.txt (without quotes).

For more info, please find board/raspberrypi/README.txt

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
---
 board/raspberrypi/README.txt |   35 +++++++++++++++++++++++++++++++++++
 configs/rpi_defconfig        |   19 +++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 board/raspberrypi/README.txt
 create mode 100644 configs/rpi_defconfig

--
1.7.10.4

Comments

Yann E. MORIN Jan. 11, 2013, 1:36 p.m. UTC | #1
Maxime, All,

On Friday 11 January 2013 14:17:30 Maxime Hadjinlian wrote:
[--SNIP--]
> diff --git a/board/raspberrypi/README.txt b/board/raspberrypi/README.txt
> new file mode 100644
> index 0000000..5ddc5c5
> --- /dev/null
> +++ b/board/raspberrypi/README.txt
> @@ -0,0 +1,35 @@
> +## RaspberryPi
> +
> +When you use the rpi_defconfig to build a rootfs for your RaspberryPi, a few
> +items are created in output/images :
> +
> +	output/images/
> +	├── rootfs.tar
> +	├── rpi-firmware
> +	│   ├── bootcode.bin
> +	│   ├── config.txt
> +	│   ├── fixup_cd.dat
> +	│   ├── fixup.dat
> +	│   ├── start_cd.elf
> +	│   └── start.elf
> +	└── zImage

Please, use only ascii chars (0x00..0x7F):
	output/images/
	+-- rootfs.tar
	+-- rpi-firmware
	|   +-- bootcode.bin
        [...]
        |   `-- start.elf
        `-- zImage

> +In order to have a working SDCard, you should have at least two partitions :
> +
> +    - First partition :
> +	This will be the boot partition (It must be formated in fat32 and have
> +        bootable flags).
> +	It should contains the *content* of output/images/rpi-firmware/.
> +        It will also contain the kernel binary.
> +        For the kernel to be found, you have two choices :
> +	    1 - Rename zImage to kernel.img since it's the default kernel file
> +                name here.
> +            2 - Add 'kernel=zImage' to config.txt (without the quotes).

kernel='kernel.img' maybe?
If not, explain what this kernel= settings means.

Otherwise, looks good to me. ;-)

Regards,
Yann E. MORIN.
Maxime Hadjinlian Jan. 11, 2013, 1:38 p.m. UTC | #2
On Fri, Jan 11, 2013 at 2:36 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Maxime, All,
>
> On Friday 11 January 2013 14:17:30 Maxime Hadjinlian wrote:
> [--SNIP--]
>> diff --git a/board/raspberrypi/README.txt b/board/raspberrypi/README.txt
>> new file mode 100644
>> index 0000000..5ddc5c5
>> --- /dev/null
>> +++ b/board/raspberrypi/README.txt
>> @@ -0,0 +1,35 @@
>> +## RaspberryPi
>> +
>> +When you use the rpi_defconfig to build a rootfs for your RaspberryPi, a few
>> +items are created in output/images :
>> +
>> +     output/images/
>> +     ├── rootfs.tar
>> +     ├── rpi-firmware
>> +     │   ├── bootcode.bin
>> +     │   ├── config.txt
>> +     │   ├── fixup_cd.dat
>> +     │   ├── fixup.dat
>> +     │   ├── start_cd.elf
>> +     │   └── start.elf
>> +     └── zImage
>
> Please, use only ascii chars (0x00..0x7F):
>         output/images/
>         +-- rootfs.tar
>         +-- rpi-firmware
>         |   +-- bootcode.bin
>         [...]
>         |   `-- start.elf
>         `-- zImage
Will do.
>
>> +In order to have a working SDCard, you should have at least two partitions :
>> +
>> +    - First partition :
>> +     This will be the boot partition (It must be formated in fat32 and have
>> +        bootable flags).
>> +     It should contains the *content* of output/images/rpi-firmware/.
>> +        It will also contain the kernel binary.
>> +        For the kernel to be found, you have two choices :
>> +         1 - Rename zImage to kernel.img since it's the default kernel file
>> +                name here.
>> +            2 - Add 'kernel=zImage' to config.txt (without the quotes).
>
> kernel='kernel.img' maybe?
Nop, as said, you have two choices for the kernel binary to be found.
Either, you rename the file so it match the default name, kernel.img.
Or, you change in the config.txt the file name the kernel should have.
> If not, explain what this kernel= settings means.
>
> Otherwise, looks good to me. ;-)
Thanks
>
> Regards,
> Yann E. MORIN.
>
> --
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |   ^                |
> | --==< O_o >==-- '------------.-------:  X  AGAINST      |  /e\  There is no  |
> | http://ymorin.is-a-geek.org/ | (*_*) | / \ HTML MAIL    |  """  conspiracy.  |
> '------------------------------'-------'------------------'--------------------'
Floris Bos Jan. 11, 2013, 3:19 p.m. UTC | #3
On 01/11/2013 02:17 PM, Maxime Hadjinlian wrote:
>      - Add 'kernel=zImage' in config.txt (without quotes).

Perhaps consider making that the default in package/rpi-firmware/config.txt

So that one can create a working Raspberry Pi image by just copying the 
files from target to a FAT formatted SD card without having to edit or 
rename anything.


Yours sincerely,

Floris Bos
Maxime Hadjinlian Jan. 11, 2013, 3:34 p.m. UTC | #4
On Fri, Jan 11, 2013 at 4:19 PM, Floris Bos <bos@je-eigen-domein.nl> wrote:
> On 01/11/2013 02:17 PM, Maxime Hadjinlian wrote:
>>
>>      - Add 'kernel=zImage' in config.txt (without quotes).
>
>
> Perhaps consider making that the default in package/rpi-firmware/config.txt
I though about this but since kernel.img is the default for the
RaspberryPi, I wanted to keep the config.txt as vanilla as possible.
Since it's pretty easy to rename the zImage into kernel.img with a
postbuild script, the end users has a choice.
>
> So that one can create a working Raspberry Pi image by just copying the
> files from target to a FAT formatted SD card without having to edit or
> rename anything.
You're absolutely right.
I'm not sure what to do here, I'll follow what the mailing will say.
>
>
> Yours sincerely,
>
> Floris Bos
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Jan. 11, 2013, 4:01 p.m. UTC | #5
Dear Floris Bos,

On Fri, 11 Jan 2013 16:19:12 +0100, Floris Bos wrote:
> On 01/11/2013 02:17 PM, Maxime Hadjinlian wrote:
> >      - Add 'kernel=zImage' in config.txt (without quotes).
> 
> Perhaps consider making that the default in package/rpi-firmware/config.txt
> 
> So that one can create a working Raspberry Pi image by just copying the 
> files from target to a FAT formatted SD card without having to edit or 
> rename anything.

I agree. Let's have a default config.txt that matches the file name of
the kernel image we generate.

Thanks,

Thomas
Thomas Petazzoni Jan. 11, 2013, 4:05 p.m. UTC | #6
Dear Maxime Hadjinlian,

On Fri, 11 Jan 2013 14:17:30 +0100, Maxime Hadjinlian wrote:
> --- /dev/null
> +++ b/board/raspberrypi/README.txt
> @@ -0,0 +1,35 @@
> +## RaspberryPi
> +
> +When you use the rpi_defconfig to build a rootfs for your RaspberryPi, a few
> +items are created in output/images :

It does not build only a rootfs, so:

When you use the rpi_defconfig to build an embedded Linux system for
your Rasberry Pi, the following elements will be generated in
output/images:

> +	output/images/
> +	├── rootfs.tar
> +	├── rpi-firmware
> +	│   ├── bootcode.bin
> +	│   ├── config.txt
> +	│   ├── fixup_cd.dat
> +	│   ├── fixup.dat
> +	│   ├── start_cd.elf
> +	│   └── start.elf
> +	└── zImage
> +
> +In order to have a working SDCard, you should have at least two partitions :
> +
> +    - First partition :
> +	This will be the boot partition (It must be formated in fat32 and have
> +        bootable flags).
> +	It should contains the *content* of output/images/rpi-firmware/.
> +        It will also contain the kernel binary.
> +        For the kernel to be found, you have two choices :
> +	    1 - Rename zImage to kernel.img since it's the default kernel file
> +                name here.
> +            2 - Add 'kernel=zImage' to config.txt (without the quotes).
> +
> +    - Second partition :
> +        This will contains the rootfs and should be formated in ext4.
> +	If you chose another filesystem, you should modify the cmdline in
> +        config.txt.
> +        Then simply extract rootfs.tar to this partition.

The indentation is really strange here. What about something like:

==
In order to boot your Rasberry Pi, you'll need to prepare your SD card
with at least two partitions:

 * The first partition is the boot partition.

   It should be FAT32-formatted and have the bootable flags.

   It should contain the contents of the output/images/rpi-firmware/
   directory: it contains bootloaders and the kernel image for the
   Rasberry Pi.

 * The second partition is the root filesystem partition.

   It should be ext4 formatted (if you choose another filesystem,
   remember to adjust the kernel command line in the config.txt file).

   Simply extract (as root!) the contents of the rootfs.tar archive
   into this partition.
==

I removed the discussion about kernel=zImage, because I think it should
be the default in our rpi-firmware package.

Thanks,

Thomas
Floris Bos Jan. 11, 2013, 5:08 p.m. UTC | #7
On 01/11/2013 02:17 PM, Maxime Hadjinlian wrote:
> In order to have a working SDCard, you should have at least two partitions :

Might also be worth mentioning that for use cases that do not require 
file changes to persist across reboots you can go the initramfs route, 
and let the bootloader load the entire rootfs to memory at boot.

- "make menuconfig" -> select "Filesystem images" -> "initramfs for 
intial ramdisk of linux kernel"
- After build simply copy the files from target to a FAT formatted SD card.

No need to mess with extra partitions that way, and you are less 
affected by the glitches the Pi's SD card kernel module has from time to 
time.


Yours sincerely,

Floris Bos
Arnout Vandecappelle Jan. 11, 2013, 8:15 p.m. UTC | #8
On 11/01/13 18:08, Floris Bos wrote:
> On 01/11/2013 02:17 PM, Maxime Hadjinlian wrote:
>> In order to have a working SDCard, you should have at least two
>> partitions :
>
> Might also be worth mentioning that for use cases that do not require
> file changes to persist across reboots you can go the initramfs route,
> and let the bootloader load the entire rootfs to memory at boot.
>
> - "make menuconfig" -> select "Filesystem images" -> "initramfs for
> intial ramdisk of linux kernel"
> - After build simply copy the files from target to a FAT formatted SD card.
>
> No need to mess with extra partitions that way, and you are less affected
> by the glitches the Pi's SD card kernel module has from time to time.

  Does the RPi bootloader support initrd loading? In that case, maybe 
it's better to default to rootfs.cpio.gz (or .lzma) and adapt the 
config.txt accordingly. That way, creating a bootable is a lot simpler: 
just chuck the entire images directory on a FAT-formatted SD card...

  Regards,
  Arnout
Floris Bos Jan. 11, 2013, 9:16 p.m. UTC | #9
On 01/11/2013 09:15 PM, Arnout Vandecappelle wrote:
> On 11/01/13 18:08, Floris Bos wrote:
>> On 01/11/2013 02:17 PM, Maxime Hadjinlian wrote:
>>> In order to have a working SDCard, you should have at least two
>>> partitions :
>>
>> Might also be worth mentioning that for use cases that do not require
>> file changes to persist across reboots you can go the initramfs route,
>> and let the bootloader load the entire rootfs to memory at boot.
>>
>> - "make menuconfig" -> select "Filesystem images" -> "initramfs for
>> intial ramdisk of linux kernel"
>> - After build simply copy the files from target to a FAT formatted SD 
>> card.
>>
>> No need to mess with extra partitions that way, and you are less 
>> affected
>> by the glitches the Pi's SD card kernel module has from time to time.
>
>  Does the RPi bootloader support initrd loading? In that case, maybe 
> it's better to default to rootfs.cpio.gz (or .lzma) and adapt the 
> config.txt accordingly. That way, creating a bootable is a lot 
> simpler: just chuck the entire images directory on a FAT-formatted SD 
> card... 

The bootloader does support loading separate initrd files through a 
config.txt option.
But the standard bcmrpi_defconfig Raspberry kernel does not, because 
CONFIG_BLK_DEV_INITRD isn't enabled in the default configuration.

If you cannot use the standard kernel, and have to compile your own 
anyway, it is easier to use the buildroot "initramfs" option, and have 
the initramfs integrated into zImage.


Yours sincerely,

Floris Bos
Arnout Vandecappelle Jan. 11, 2013, 11:22 p.m. UTC | #10
On 11/01/13 22:16, Floris Bos wrote:
> The bootloader does support loading separate initrd files through a
> config.txt option.
> But the standard bcmrpi_defconfig Raspberry kernel does not, because
> CONFIG_BLK_DEV_INITRD isn't enabled in the default configuration.

  Bummer.

> If you cannot use the standard kernel, and have to compile your own
> anyway, it is easier to use the buildroot "initramfs" option, and have
> the initramfs integrated into zImage.

  It's just that that increases compile time, with little real benefit 
over a separate initramfs.

  Regards,
  Arnout
diff mbox

Patch

diff --git a/board/raspberrypi/README.txt b/board/raspberrypi/README.txt
new file mode 100644
index 0000000..5ddc5c5
--- /dev/null
+++ b/board/raspberrypi/README.txt
@@ -0,0 +1,35 @@ 
+## RaspberryPi
+
+When you use the rpi_defconfig to build a rootfs for your RaspberryPi, a few
+items are created in output/images :
+
+	output/images/
+	├── rootfs.tar
+	├── rpi-firmware
+	│   ├── bootcode.bin
+	│   ├── config.txt
+	│   ├── fixup_cd.dat
+	│   ├── fixup.dat
+	│   ├── start_cd.elf
+	│   └── start.elf
+	└── zImage
+
+In order to have a working SDCard, you should have at least two partitions :
+
+    - First partition :
+	This will be the boot partition (It must be formated in fat32 and have
+        bootable flags).
+	It should contains the *content* of output/images/rpi-firmware/.
+        It will also contain the kernel binary.
+        For the kernel to be found, you have two choices :
+	    1 - Rename zImage to kernel.img since it's the default kernel file
+                name here.
+            2 - Add 'kernel=zImage' to config.txt (without the quotes).
+
+    - Second partition :
+        This will contains the rootfs and should be formated in ext4.
+	If you chose another filesystem, you should modify the cmdline in
+        config.txt.
+        Then simply extract rootfs.tar to this partition.
+
+Finally, a good source of information is http://elinux.org/R-Pi_Hub
diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig
new file mode 100644
index 0000000..8c73d0e
--- /dev/null
+++ b/configs/rpi_defconfig
@@ -0,0 +1,19 @@ 
+BR2_arm=y
+BR2_arm1176jzf_s=y
+
+BR2_TOOLCHAIN_BUILDROOT_LARGEFILE=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+
+BR2_TARGET_GENERIC_GETTY_PORT="tty1"
+
+BR2_PACKAGE_RPI_FIRMWARE=y
+BR2_PACKAGE_RPI_USERLAND=y
+BR2_PACKAGE_LIBCOFI=y
+
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_GIT_REPO_URL="git://github.com/raspberrypi/linux.git"
+BR2_LINUX_KERNEL_CUSTOM_GIT_VERSION="31a951046155b27361127d9cf85a1f58719fe9b3"
+BR2_LINUX_KERNEL_USE_DEFCONFIG=y
+BR2_LINUX_KERNEL_DEFCONFIG="bcmrpi"
+BR2_LINUX_KERNEL_ZIMAGE=y