Skip to contentSkip to conversation

buildroot and sh4

Buildroot Philippe Reynes 5 participants 14 messages Jun 3, 2010 – Nov 28, 2010

lore
Share & tools
lore
#0 lore raw

Hi

I've done a little doc about building an image for sh4 with buildroot and run it with qemu. As you could see, it's quite trivial, except the option for the compiler, and option for qemu.

1) get builroot source
git clone git://git.buildroot.net/buildroot

2) go in buildroot directory
cd buildroot

3) configure builroot
run : make menuconfig
and set :
Target Architecture => superh
Target Architecure variant => sh4
Target options => nothing to change
Build options => nothing to change
Toolchain =>
??? GCC compiler Version => 4.4.x
??? Additionnal gcc options => --with-multilib-list=m4,m4-nofpu ??? Enable multilib support => yes
Package Section for the target => nothing to change
Target filesystem options => nothing to change
Bootloader => no
Kernel =>
??? Kernel type => linux (advanced configuration)
??? Linux kernel version => The latest stable Linux kernel (2.6.33.4) ??? Patches => nothing to change
??? Linux Kernel Configuration => nothing to change
??? kernel binary format => zImage
??? Destination for linux kernel binaries => nothing to change

4) compile buildroot
make all

as kernel config file, use this one :
config_2_6_33_4_sh.txt

5) run qemu

qemu-system-sh4 -M r2d -kernel output/images/zImage -drive file=output/images/rootfs.ext2,if=ide,format=raw -append root=/dev/sda console=tty0 console=ttySC1,115200 noiotrap

the config file can be found here : http://www.zarb.org/~trem/sh/
there are 2 files :
- install_br_sh4.txt : this little doc
- config_2_6_33_4_sh.txt : configuration for a kernel 2.6.33.4 on sh4

I hope this little doc will be usefull, and I'll be pleased to get feedback, trem

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20100603/5154f468/attachment.html>

#1 lore raw

Hello Philippe,

Thanks for this documentation and your efforts to build a working demonstration of Buildroot on sh4 with Qemu!

Quoted 2 lines · On Thu, 3 Jun 2010 22:08:17 +0000 (GMT) Philippe Reynes <[email protected]>…

??? GCC compiler Version => 4.4.x
??? Additionnal gcc options => --with-multilib-list=m4,m4-nofpu

Does this actually work ?

To produce a multilib toolchain, you need to build the C library as many times as you have items in this "with-multilib-list". However, as far as I understand Buildroot's code to generate toolchains, it only builds uClibc once. Did you actually check that this multilib thing was working ?

Quoted 1 line

I hope this little doc will be usefull, and I'll be pleased to get feedback,

I think it'd be great if we added a target/device/qemu directory, with target/device/qemu/sh4-rd2 as a sub-directory, containing your kernel configuration + a small README file saying how to run Qemu. Then, your Buildroot config file could be added to the configs/ directory. This ways, others could easily run this.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw
Quoted 9 lines · Thomas Petazzoni

I think it'd be great if we added a target/device/qemu directory, with target/device/qemu/sh4-rd2 as a sub-directory, containing your kernel configuration + a small README file saying how to run Qemu. Then, your Buildroot config file could be added to the configs/ directory. This ways, others could easily run this.

Thomas

Same for Versatile PB or Integrator CP for ARM, I can do that.

Signature · 4 lines
Pierre FICHEUX -/- CTO OW/OS4I, France -\- pierre.ficheux at openwide.fr
                                         http://www.os4i.com
                                         http://www.ficheux.org
I would love to change the world, but they won't give me the source code
#3 lore raw
Quoted 1 line · On Fri, 04 Jun 2010 10:39:11 +0200 Pierre Ficheux <[email protected]>…

Same for Versatile PB or Integrator CP for ARM, I can do that.

Yes, of course. It'd be great to have known-working defconfigs for the different CPU architectures that Qemu support: x86, x86_64, ARM, MIPS, PowerPC.

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw
In reply to Thomas Petazzoni
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Thomas> I think it'd be great if we added a target/device/qemu Thomas> directory, with target/device/qemu/sh4-rd2 as a sub-directory, Thomas> containing your kernel configuration + a small README file Thomas> saying how to run Qemu. Then, your Buildroot config file could Thomas> be added to the configs/ directory. This ways, others could Thomas> easily run this.

Agreed.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw
In reply to Thomas Petazzoni

Hi

I've checked my additionnal gcc options, and here the result :

If I don't add --with-multilib-list=m4,m4-nofpu, the kernel compilation fails with the following error :

make[1]: entrant dans le r?pertoire ? /home/trem/mes_codes/buildroot/temp/buildroot/output/build/linux-2.6.33.4 ? ? CHK???? include/linux/version.h
? UPD???? include/linux/version.h
? CHK???? include/generated/utsrelease.h
? UPD???? include/generated/utsrelease.h
? Generating include/generated/machtypes.h
? CC????? kernel/bounds.s
cc1: error: command line option '-m4-nofpu' is not supported by this configuration
cc1: error: command line option '-m4-nofpu' is not supported by this configuration
make[2]: *** [kernel/bounds.s] Erreur 1
make[1]: *** [prepare0] Erreur 2
make[1]: quittant le r?pertoire ? /home/trem/mes_codes/buildroot/temp/buildroot/output/build/linux-2.6.33.4 ?
make: *** [/home/trem/mes_codes/buildroot/temp/buildroot/output/build/linux-2.6.33.4/.depend_done] Erreur 2

If I add --with-multilib-list=m4,m4-nofpu, the kernel compilation works fine.

As others, I think that adding a directory target/device/qemu, and give a working configuration for building an image that run on qemu is a nice idea. I add the sh architecture to my todo list.

Philippe

--- En date de?: Ven 4.6.10, Thomas Petazzoni <[email protected]> a ?crit?:

De: Thomas Petazzoni <[email protected]>
Objet: Re: [Buildroot] buildroot and sh4
?: buildroot at busybox.net
Date: Vendredi 4 juin 2010, 9h36

Hello Philippe,

Thanks for this documentation and your efforts to build a working demonstration of Buildroot on sh4 with Qemu!

Quoted 2 lines · On Thu, 3 Jun 2010 22:08:17 +0000 (GMT) Philippe Reynes <[email protected]>…

??? GCC compiler Version => 4.4.x
??? Additionnal gcc options => --with-multilib-list=m4,m4-nofpu

Does this actually work ?

To produce a multilib toolchain, you need to build the C library as many times as you have items in this "with-multilib-list". However, as far as I understand Buildroot's code to generate toolchains, it only builds uClibc once. Did you actually check that this multilib thing was working ?

Quoted 1 line

I hope this little doc will be usefull, and I'll be pleased to get feedback,

I think it'd be great if we added a target/device/qemu directory, with target/device/qemu/sh4-rd2 as a sub-directory, containing your kernel configuration + a small README file saying how to run Qemu. Then, your Buildroot config file could be added to the configs/ directory. This ways, others could easily run this.

Thomas

Signature · 15 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20100604/9509e1c9/attachment.html>
#7 lore raw

Hi,

First, sorry for this late answer.

I've done a little patch that add a qemu device target for sh4. You could find it here : http://zarb.org/~trem/buildroot/add_qemu_sh4_r2d_target.patch

regards,
Philippe

--- En date de?: Lun 7.6.10, Phil Edworthy <[email protected]> a ?crit?:

De: Phil Edworthy <[email protected]>
Objet: RE: [Buildroot] buildroot and sh4
?: "Philippe Reynes" <[email protected]>, buildroot at busybox.net, "Thomas Petazzoni" <[email protected]>
Date: Lundi 7 juin 2010, 11h14

BTW, I have successfully used a
CodeSourcery external toolchain with Buildroot on sh4 (MS7724 development board). I?m currently waiting for git access via http before creating patches for this?

?

Phil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20100703/81428c14/attachment-0001.html>

#8 lore raw

Hi all,

I've done a new version of the sh4 patch, you could find it her:
http://ryu.zarb.org/~trem/buildroot/0001-Add-a-qemu-device-target-sh4-r2d.patch

I've added a sh4_defconfig in the config directory as asked by Thomas.

Philippe

--- En date de?: Sam 3.7.10, Philippe Reynes <[email protected]> a ?crit?:

De: Philippe Reynes <[email protected]>
Objet: Re: [Buildroot] buildroot and sh4
?: buildroot at busybox.net, "Thomas Petazzoni" <[email protected]>, "Phil Edworthy" <[email protected]>
Date: Samedi 3 juillet 2010, 12h52

Hi,

First, sorry for this late answer.

I've done a little patch that add a qemu device target for sh4. You could find it here : http://zarb.org/~trem/buildroot/add_qemu_sh4_r2d_target.patch

regards,
Philippe

--- En date de?: Lun 7.6.10, Phil Edworthy <[email protected]> a ?crit?:

De: Phil Edworthy <[email protected]>
Objet: RE: [Buildroot] buildroot and sh4
?: "Philippe Reynes" <[email protected]>, buildroot at busybox.net, "Thomas Petazzoni" <[email protected]>
Date: Lundi 7 juin 2010, 11h14

BTW, I have successfully used a
CodeSourcery external toolchain with Buildroot on sh4 (MS7724 development board). I?m currently waiting for git access via http before creating patches for this?

?

Phil

-----La pi?ce jointe associ?e suit-----

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20100727/6f732418/attachment-0001.html>

#9 lore raw

Hello Philippe,

Quoted 4 lines · On Tue, 27 Jul 2010 22:16:11 +0000 (GMT) Philippe Reynes <[email protected]>…

I've done a new version of the sh4 patch, you could find it her:
http://ryu.zarb.org/~trem/buildroot/0001-Add-a-qemu-device-target-sh4-r2d.patch

I've added a sh4_defconfig in the config directory as asked by Thomas.

Since I'm almost at the end of the cleanup of the board stuff, I wanted to merge your work to add support for a Qemu/SH4 target. Unfortunately, the URL above now returns a 404. Do you have this patch still available somewhere ?

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
author
#11 lore raw
Quoted 10 lines · Phil Edworthy

Hi Thomas,

Quoted 7 lines
Quoted 3 lines · On Tue, 27 Jul 2010 22:16:11 +0000 (GMT) Philippe Reynes<[email protected]>…

I've done a new version of the sh4 patch, you could find it her:
http://ryu.zarb.org/~trem/buildroot/0001-Add-a-qemu-device-target-sh4-

Quoted 7 lines
Quoted 2 lines

r2d.patch

That url works fine for me, though I haven't tried the patch itself.

Thanks
Phil

Hi all

I've done a new version of the patch based on branch boards-cleanup of git://git.busybox.net/~tpetazzoni/git/buildroot

This new patch could be find here :
http://ryu.zarb.org/~trem/buildroot/0002-Add-a-qemu-device-target-sh4-r2d.patch

regards,
trem

#12 lore raw
Quoted 5 lines · On Sun, 14 Nov 2010 23:09:03 +0100 trem <[email protected]> wrote:

I've done a new version of the patch based on branch boards-cleanup of git://git.busybox.net/~tpetazzoni/git/buildroot

This new patch could be find here :
http://ryu.zarb.org/~trem/buildroot/0002-Add-a-qemu-device-target-sh4-r2d.patch

This patch does not follow completely the "new" way of adding board support in Buildroot:

* The kernel configuration file should have been saved using "make savedefconfig" in your kernel directory, so as to have a minimal defconfig instead of this huge defconfig.

* Similarly, the Buildroot configuration file should have been saved using "make savedefconfig" in your Buildroot directory.

With this, instead of having several tens of kilobytes of configuration files, you'll have only a few hundred bytes of configuration.

Thanks !

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
author
#13 lore raw
Quoted 20 lines · Thomas Petazzoni
Quoted 6 lines · On Sun, 14 Nov 2010 23:09:03 +0100 trem<[email protected]> wrote:

I've done a new version of the patch based on branch boards-cleanup of git://git.busybox.net/~tpetazzoni/git/buildroot

This new patch could be find here :
http://ryu.zarb.org/~trem/buildroot/0002-Add-a-qemu-device-target-sh4-r2d.patch

This patch does not follow completely the "new" way of adding board support in Buildroot:

* The kernel configuration file should have been saved using "make savedefconfig" in your kernel directory, so as to have a minimal defconfig instead of this huge defconfig.

* Similarly, the Buildroot configuration file should have been saved using "make savedefconfig" in your Buildroot directory.

Quoted 7 lines

With this, instead of having several tens of kilobytes of configuration files, you'll have only a few hundred bytes of configuration.

Thanks !

Thomas

Hi

I've done a new version of the patch based on
git://git.busybox.net/~tpetazzoni/git/buildroot
branch remotes/origin/for-2011.02/boards-cleanup.

The buildroot config and the kernel config use a defconf, so it's very small.

This patch could be found here : http://ryu.zarb.org/~trem/buildroot/

regards,
Philippe