Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v1 2/9] board/intel/common: Add common files for x86 boards
Date: Thu, 25 Aug 2016 23:37:05 +0200	[thread overview]
Message-ID: <20160825233705.5a061f79@free-electrons.com> (raw)
In-Reply-To: <1472133887-34746-3-git-send-email-andriy.shevchenko@linux.intel.com>

Hello,

On Thu, 25 Aug 2016 17:04:40 +0300, Andy Shevchenko wrote:
> There are several x86 boards that can utilize same image creation
> infrastructure.
> 
> Add common configuration, cmdline, post-image.sh, post-build.sh scripts and
> placeholders for their extensions.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks for working on this, it's great to see contributions from Intel
for those platforms. However, I'm afraid, quite a few things in there
really aren't done in the Buildroot spirit/philosophy. See some
comments below.


> diff --git a/board/intel/common/README.rst b/board/intel/common/README.rst
> new file mode 100644
> index 0000000..e427067
> --- /dev/null
> +++ b/board/intel/common/README.rst

We don't use the .rst format anywhere else in the tree, so please stick
to a regular readme.txt, like we have for all other platforms.

> +Building an image
> +~~~~~~~~~~~~~~~~~
> +
> +For building a normal bootable image, you need to do following steps:
> +
> +1) Build your own kernel.
> +
> +2) Configure Buildroot.
> +
> +The Buildroot configuration would be done by running::
> +
> +	% make <BOARD>_defconfig
> +
> +For most of the boards it's good enough to use generic [intel_defconfig]_.
> +
> +3) Build Buildroot.
> +
> +Build the necessary Buildroot packages and resulting image::
> +
> +	% make KERNEL_SRC=~/linux

What is this magic KERNEL_SRC variable? In appearance at least, it
completely circumvents the Buildroot config options for specifying where
the kernel sources are located. So this is clearly a no-go.

> +Supported environment variables
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The scripts under ``board/intel/common`` accept several environment variables
> +that can be used to alter the default behaviour. Typically you do something
> +like::
> +
> +	% make KERNEL_SRC=~/linux

Should not exist.

> +in order to take advantage of these.
> +
> +BOARD_INTEL_CUSTOM_CMDLINE
> +	provides a custom appendix to the command line.
> +
> +BOARD_INTEL_DIR
> +	points to a specific board directory.
> +
> +KERNEL_SRC
> +	path to your kernel output folder.

I'm not sure any of these should exist. KERNEL_SRC is already something
provided by Buildroot.

The board directory can be known by other ways (see how the various
raspberrypi variants are handled, for example).

> +Alterate console

Alterate, or alternate ?

> +~~~~~~~~~~~~~~~~
> +
> +By default ``ttyS0`` is used as a default cosole for both kernel and userspace.

cosole -> console

> +The **BR2_TARGET_GENERIC_GETTY_PORT** variable could be used to alterate this
> +setting.

Why not, but this is general Buildroot usage, not related to Intel
boards specifically.

> +Supported boards
> +~~~~~~~~~~~~~~~~
> +
> +.. [intel_defconfig] Generic config for most of Intel SoCs.

This part is pretty uninformative :)

> +Examples
> +~~~~~~~~
> +
> +- ASuS T100TA and the rest with ``ttyUSB0``::
> +
> +	% make KERNEL_SRC=~/linux BR2_TARGET_GENERIC_GETTY_PORT=ttyUSB0		\
> +				  BOARD_INTEL_CUSTOM_CMDLINE="reboot=h,p"
> +
> +- Galileo (Quark)::
> +
> +	% make KERNEL_SRC=~/linux BR2_TARGET_GENERIC_GETTY_PORT=ttyS1
> +
> +- Joule (Broxton), Edison (Merrifield)::
> +
> +	% make KERNEL_SRC=~/linux BR2_TARGET_GENERIC_GETTY_PORT=ttyS2
> +
> +- Minnowboard [#]_::
> +
> +	% make KERNEL_SRC=~/linux BR2_TARGET_GENERIC_GETTY_PORT=ttyPCH0
> +
> +.. [#] Minnowboard MAX goes the standard way with ``ttyS0``.

Please instead provide different defconfigs for those platforms:

	galileo_defconfig
	minnowboard_defconfig
	joule_defconfig

etc.


> diff --git a/board/intel/common/post-build.d/README b/board/intel/common/post-build.d/README
> new file mode 100644
> index 0000000..5bcb10b
> --- /dev/null
> +++ b/board/intel/common/post-build.d/README
> @@ -0,0 +1,4 @@
> +#
> +# This folder contains the shell scripts which will be executed in alphabetical
> +# order on post build stage.
> +#

I don't think we want an Intel specific mechanism for directories
containing post-build scripts. I'd prefer to extend the current
BR2_ROOTFS_POST_BUILD_SCRIPT logic (which allows to pass multiple
space-separated post-build script) to automatically run all scripts in
a directory if one entry in BR2_ROOTFS_POST_BUILD_SCRIPT is a directory.

Or maybe, with the small number of post-build scripts and post-image
scripts that you have, just call them from the relevant board defconfig.

> +# Read cmdline and modify console parameter
> +sed -e "s#$console_default#$console#" "$cmdline" > "$BINARIES_DIR/cmdline"

What is this cmdline file doing in the end?

> diff --git a/board/intel/common/post-image.d/40-prepare-initrd b/board/intel/common/post-image.d/40-prepare-initrd
> new file mode 100755
> index 0000000..7bf7769
> --- /dev/null
> +++ b/board/intel/common/post-image.d/40-prepare-initrd
> @@ -0,0 +1,14 @@
> +#!/bin/sh -e
> +
> +#
> +# Copyright (c) 2016 Intel Corp.
> +#
> +
> +#
> +# Environment:
> +#
> +# None
> +#

That's really a whole lot of nothing for just a single line of useful
code :-)

> diff --git a/configs/intel_defconfig b/configs/intel_defconfig
> new file mode 100644
> index 0000000..8aff9e1
> --- /dev/null
> +++ b/configs/intel_defconfig

We don't have the concept of such generic defconfigs. We have defconfig
per identified platform, and I'm not really sure to understand the
logic behind this generic defconfig that then needs to be passed
through custom environment variables to be customized depending on the
platform.

It's clearly not the direction I would like to take for the defconfigs.

> +# Packages
> +BR2_PACKAGE_KEXEC=y
> +BR2_PACKAGE_KEXEC_ZLIB=y
> +BR2_PACKAGE_LRZSZ=y
> +BR2_PACKAGE_SCREEN=y

We normally don't enable specific packages in our defconfig, since they
are meant to be minimal, i.e just the toolchain, kernel, bootloader,
and Busybox userspace.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2016-08-25 21:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25 14:04 [Buildroot] [PATCH v1 0/9] board: introduce common infrastructure for Intel SoCs Andy Shevchenko
2016-08-25 14:04 ` [Buildroot] [PATCH v1 1/9] package/acpica: Add host configuration to the tool Andy Shevchenko
2016-08-25 21:44   ` Thomas Petazzoni
2016-08-26 10:50   ` Erico Nunes
2016-08-25 14:04 ` [Buildroot] [PATCH v1 2/9] board/intel/common: Add common files for x86 boards Andy Shevchenko
2016-08-25 21:37   ` Thomas Petazzoni [this message]
2016-08-26 16:42   ` Arnout Vandecappelle
2016-08-25 14:04 ` [Buildroot] [PATCH v1 3/9] board/intel/common: Add possibility for adding ACPI tables to the initrd Andy Shevchenko
2016-08-25 21:43   ` Thomas Petazzoni
2016-08-26  6:13   ` Arnout Vandecappelle
2016-08-26  8:39     ` Thomas Petazzoni
     [not found]     ` <20160826090454.GK1812@lahna.fi.intel.com>
2016-08-26  9:30       ` Thomas Petazzoni
     [not found]         ` <20160826093901.GO1812@lahna.fi.intel.com>
2016-08-26 13:28           ` Thomas Petazzoni
2016-08-26 16:30           ` Arnout Vandecappelle
     [not found]             ` <20160829065522.GV1812@lahna.fi.intel.com>
2016-08-29  7:45               ` Arnout Vandecappelle
     [not found]                 ` <20160829075810.GA1709@lahna.fi.intel.com>
2016-08-29  9:08                   ` Arnout Vandecappelle
2016-08-25 14:04 ` [Buildroot] [PATCH v1 4/9] board / intel: Add SPI peripherals for Minnowboard MAX Andy Shevchenko
2016-08-25 21:47   ` Thomas Petazzoni
     [not found]     ` <20160826090917.GL1812@lahna.fi.intel.com>
2016-08-26  9:26       ` Thomas Petazzoni
2016-08-25 14:04 ` [Buildroot] [PATCH v1 5/9] board / intel: Add SPI peripherals for Joule Andy Shevchenko
2016-08-25 14:04 ` [Buildroot] [PATCH v1 6/9] board / intel: Add Aosong AM2315 sensor for Intel Joule Andy Shevchenko
2016-08-25 14:04 ` [Buildroot] [PATCH v1 7/9] board / intel: Add GPIO LEDs " Andy Shevchenko
2016-08-25 14:04 ` [Buildroot] [PATCH v1 8/9] board / intel: Add GPIO LEDs for Intel Minnowboard Andy Shevchenko
2016-08-25 14:04 ` [Buildroot] [PATCH v1 9/9] board / intel: Add GPIO buttons " Andy Shevchenko

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=20160825233705.5a061f79@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox