Re: Building a custom kernel via cross compiling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi again Peter,

following on from my earlier question, I'm interested in how to modify my
config files and subsequent rpmbuild command in order to build the kernel
with options specific to my OEM board.

>From what I've read in more general sources about buiding the linux kernel.
there's a .config file at the root of the kernel source tree which will
contain options specific to the board targeted indicating the whether
modules are built in or not.

I have a mydevice.defconfig file corresponding to the .config file which
was used with our Angstrom builds but I assume it needs to be updated for
the much later Fedora kernel.

So I copied mydevice_defconfig to

/kernel/kernel-4.0.fc22/linux-4.0.8-300.fc22.x86_64/arch/arm/configs

Tried to merge it with a more 'modern' config...

ARCH=arm sudo ./scripts/kconfig/merge_config.sh
./arch/arm/configs/mydevice_defconfig ./configs/kernel-4.0.8-armv7hl.config

Modified a few options..

sudo dnf install ncurses-devel

sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnu- menuconfig

Is this the correct procedure?

Whether the above is correct or incorrect, it did create me a new .config
file which looked vaguely plausible.

So does rpmbuild use my new .config or do I indicate with some option that
it should do so?

Thanks for any clarification (from anyone!)

Andrew






On 9 July 2015 at 16:52, Andrew Wing <andrew.wing@xxxxxxxxxx> wrote:

> 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@xxxxxxxxx> 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
>>
>
>
_______________________________________________
kernel mailing list
kernel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/kernel




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux