Thanks Peter that was most helpful. Aside from running out of space on my
undersized virtual box and a bit of a wait, everything went pretty
painlessly following those instructions. For the benefit of any future
readers/sake of completeness, to get the cross-compiling etc. under way I
installed the following packages from the command line (other dependent
packages installed for free of course)
gcc
gcc-arm-linux-gnu
hmaccalc
m4
Andrew
On 8 July 2015 at 22:48, Peter Robinson <pbrobinson(a)gmail.com> wrote:
Hi Andrew,
> I am a newbie with kernel matters so I apologize in advance for what is a
> newbie type setup question. My feeling is that if I send this query to
the
> more general Arm Fedora forum, the mere mention of kernel will provoke
> glazed eyes :-)
Unlikely, I do it all the time, happy to help ;-)
> The background is that I have an OEM board based on a TI AM3352 OMAP
family
> SoC looking somewhat like a Beaglebone black. Recently I've been
exploring
> getting this running under Fedora. In order to get it working I've
cobbled
> together the F22 minimal image along with a device tree blob created by a
> colleague for this board, and a customised MLO/u-boot.
>
> My next task is to look through and understand the arm kernel sources,
> customize various aspects of the kernel config for my board and re-build.
>
> It seems that instructions are here:
>
>
https://fedoraproject.org/wiki/Building_a_custom_kernel
>
> However, I want to cross compile on a host system. To ease this process I
> have set up a Fedora x86 box, also running f22, which is going to be the
> host build machine.
>
> I decided I should build from source rpm and was following the wiki
> instructions(rpmdev-setuptree etc.) up to the point here...
The easiest way to do this is:
Install the Fedora packaging tools:
"dnf install fedora-packager"
Clone the kernel package source and switch the F-22 branch:
"fedpkg clone -a kernel"
cd kernel
"fedpkg switch-branch f22"
The kernel config for the am33xx devices like the BBB is in a file
called config-armv7. It's a bit confusing to get started but basically
there's inheritance on the config files config-generic ->
config-arm-generic -> config-armv7-generic -> config-armv7
Most of the bits related to the am33xx are in a section titled "#
AM33xx/43xx"
Adjust the config as you like. Once you've done that run "fedpkg prep"
which will make sure all your config changes aren't missing anything.
Then do "fedpkg srpm" to create a .src.rpm
Then to cross compile run the following command:
rpmbuild --rebuild --target armv7hl --with=cross --without=perf
--without=tools --without=debuginfo --without=pae --define="_arch arm"
--define="_build_arch arm" --define="__strip
/usr/bin/arm-linux-gnu-strip" kernel-version.src.rpm
That will builder you the kernel and modules. You want to leave out
tools/perf as they don't tend to cross compile well but it's unlikely
they'll differ much from the ones we already ship, I've never had an
issue with those.
> At this point I'd like to actually have a target of arm7l for my target
but
> entering this gets me an unknown target error (possibly not surprising
> given the build machine/target architecture difference!).
Use the command above and you should be good.
> My build machine does have a suitable linaro Arm compiler in place. It
> occurs to me that I need a different kernel spec and to indicate to my
> build system to use my compiler. Hopefully this can be achieved via some
> slightly modified step from that given in the wiki page? Or should I be
> tackling this in a completely different way?
The above command will prompt you to install the Fedora cross compiler
toolchain, I would recommend using that, it works fine for am33xx and
other ARMv7 devices, YMMV with Linaro toolchain.
Peter