* [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations.
@ 2019-01-29 13:23 Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 1/8] board/raspberrypi: Unify the genimage config files Robert J. Heywood
` (8 more replies)
0 siblings, 9 replies; 14+ messages in thread
From: Robert J. Heywood @ 2019-01-29 13:23 UTC (permalink / raw)
To: buildroot
Hi all.
I wanted to do use u-boot and mainline kernel sources with my raspies
but in trying to do so, found that doing it required a lot of changes
to the genimage cfg files.
All the files were basically the same, and I found that they, and the
post-image script define constants which are no longer correct if the
corresponding options are changed in buildroot.
(eg. BR2_LINUX_KERNEL_INTREE_DTS_NAME)
I've improved the situation by first removing the replication in the
cfg files (consolidating them into a single generic file). And then
parsing the .config file for the board specific pieces; like the
device tree files, and the kernel target (zimage vs image).
Then I added some new options;
- Adding files to the boot partition,
Allowing me to include uboot.bin.
- Changing the kernel in the config.txt file,
Allowing me to boot uboot.bin.
- Specifying a different rootfs file,
Since i would like to use btrfs instead of ext4.
- An option to skip creating the full sdimg.
As I'm using btrfs, in some cases I only need the vfat boot blob
from genimage.
There are a couple of aspects you might find questionable that I would
welcome comments on;
The script now modifies the generic genimage.cfg file and creates a
temporary cfg file to be used with genimage. I've chosen to place
the file at; ${BUILD_DIR}/genimage.cfg
This might not be the best choice.
I'm using a conbination of grep and eval to pull specific values out
of the .config file and get them into the script. That might not be
best practice.
Maybe theres a cleaner way of accessing those variables?
Kind regards,
~rob.
Robert J. Heywood (8):
board/raspberrypi: Unify the genimage config files
board/raspberrypi: post-image --overlays option.
board/raspberrypi: post-image, include .config dfs files.
board/raspberrypi: post-image, include .config kernel target.
board/raspberrypi: post-image --file option
board/raspberrypi: post-image --rootfs option
board/raspberrypi: post-image --skip-sdimg option
board/raspberrypi: post-image --kernel option
DEVELOPERS | 3 ++
...rrypi2.cfg => genimage-raspberrypi-generic.cfg} | 7 +--
board/raspberrypi/genimage-raspberrypi.cfg | 32 ------------
board/raspberrypi/genimage-raspberrypi0.cfg | 30 ------------
board/raspberrypi/genimage-raspberrypi0w.cfg | 31 ------------
board/raspberrypi/genimage-raspberrypi3-64.cfg | 32 ------------
board/raspberrypi/genimage-raspberrypi3.cfg | 33 -------------
board/raspberrypi/post-image.sh | 57 +++++++++++++++++++++-
8 files changed, 62 insertions(+), 163 deletions(-)
rename board/raspberrypi/{genimage-raspberrypi2.cfg => genimage-raspberrypi-generic.cfg} (85%)
delete mode 100644 board/raspberrypi/genimage-raspberrypi.cfg
delete mode 100644 board/raspberrypi/genimage-raspberrypi0.cfg
delete mode 100644 board/raspberrypi/genimage-raspberrypi0w.cfg
delete mode 100644 board/raspberrypi/genimage-raspberrypi3-64.cfg
delete mode 100644 board/raspberrypi/genimage-raspberrypi3.cfg
--
2.11.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 1/8] board/raspberrypi: Unify the genimage config files
2019-01-29 13:23 [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Robert J. Heywood
@ 2019-01-29 13:23 ` Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 2/8] board/raspberrypi: post-image --overlays option Robert J. Heywood
` (7 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Robert J. Heywood @ 2019-01-29 13:23 UTC (permalink / raw)
To: buildroot
Add a new genimage config file containing all the common elements.
The config file contains a marker which post-image.sh replaces with
files defined in the board-specific .conf files.
Since I've substantially edited the way the post-image script works,
I've added myself to the developers file for board/raspberrypi
Signed-off-by: Robert J. Heywood <robert.heywood@codethink.co.uk>
---
DEVELOPERS | 3 ++
...rrypi2.cfg => genimage-raspberrypi-generic.cfg} | 3 +-
board/raspberrypi/genimage-raspberrypi.cfg | 32 ---------------------
board/raspberrypi/genimage-raspberrypi0.cfg | 30 --------------------
board/raspberrypi/genimage-raspberrypi0w.cfg | 31 --------------------
board/raspberrypi/genimage-raspberrypi3-64.cfg | 32 ---------------------
board/raspberrypi/genimage-raspberrypi3.cfg | 33 ----------------------
board/raspberrypi/post-image.sh | 17 +++++++++--
board/raspberrypi/raspberrypi.conf | 6 ++++
board/raspberrypi/raspberrypi0.conf | 4 +++
board/raspberrypi/raspberrypi0w.conf | 5 ++++
board/raspberrypi/raspberrypi2.conf | 4 +++
board/raspberrypi/raspberrypi3-64.conf | 6 ++++
board/raspberrypi/raspberrypi3.conf | 7 +++++
14 files changed, 51 insertions(+), 162 deletions(-)
rename board/raspberrypi/{genimage-raspberrypi2.cfg => genimage-raspberrypi-generic.cfg} (90%)
delete mode 100644 board/raspberrypi/genimage-raspberrypi.cfg
delete mode 100644 board/raspberrypi/genimage-raspberrypi0.cfg
delete mode 100644 board/raspberrypi/genimage-raspberrypi0w.cfg
delete mode 100644 board/raspberrypi/genimage-raspberrypi3-64.cfg
delete mode 100644 board/raspberrypi/genimage-raspberrypi3.cfg
create mode 100644 board/raspberrypi/raspberrypi.conf
create mode 100644 board/raspberrypi/raspberrypi0.conf
create mode 100644 board/raspberrypi/raspberrypi0w.conf
create mode 100644 board/raspberrypi/raspberrypi2.conf
create mode 100644 board/raspberrypi/raspberrypi3-64.conf
create mode 100644 board/raspberrypi/raspberrypi3.conf
diff --git a/DEVELOPERS b/DEVELOPERS
index c1950bb0f4..833adf8747 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1820,6 +1820,9 @@ F: package/subversion/
N: RJ Ascani <rj.ascani@gmail.com>
F: package/azmq/
+N: Robert Heywood <robert.heywood@codethink.co.uk>
+F: board/raspberrypi/
+
N: Robert Rose <robertroyrose@gmail.com>
F: package/grpc/
diff --git a/board/raspberrypi/genimage-raspberrypi2.cfg b/board/raspberrypi/genimage-raspberrypi-generic.cfg
similarity index 90%
rename from board/raspberrypi/genimage-raspberrypi2.cfg
rename to board/raspberrypi/genimage-raspberrypi-generic.cfg
index a3be2a3442..8bdd553a34 100644
--- a/board/raspberrypi/genimage-raspberrypi2.cfg
+++ b/board/raspberrypi/genimage-raspberrypi-generic.cfg
@@ -1,13 +1,12 @@
image boot.vfat {
vfat {
files = {
- "bcm2709-rpi-2-b.dtb",
"rpi-firmware/bootcode.bin",
"rpi-firmware/cmdline.txt",
"rpi-firmware/config.txt",
"rpi-firmware/fixup.dat",
"rpi-firmware/start.elf",
- "zImage"
+ {BOOT_FILES}
}
}
size = 32M
diff --git a/board/raspberrypi/genimage-raspberrypi.cfg b/board/raspberrypi/genimage-raspberrypi.cfg
deleted file mode 100644
index bd5166a0f3..0000000000
--- a/board/raspberrypi/genimage-raspberrypi.cfg
+++ /dev/null
@@ -1,32 +0,0 @@
-image boot.vfat {
- vfat {
- files = {
- "bcm2708-rpi-b.dtb",
- "bcm2708-rpi-b-plus.dtb",
- "bcm2708-rpi-cm.dtb",
- "rpi-firmware/bootcode.bin",
- "rpi-firmware/cmdline.txt",
- "rpi-firmware/config.txt",
- "rpi-firmware/fixup.dat",
- "rpi-firmware/start.elf",
- "zImage"
- }
- }
- size = 32M
-}
-
-image sdcard.img {
- hdimage {
- }
-
- partition boot {
- partition-type = 0xC
- bootable = "true"
- image = "boot.vfat"
- }
-
- partition rootfs {
- partition-type = 0x83
- image = "rootfs.ext4"
- }
-}
diff --git a/board/raspberrypi/genimage-raspberrypi0.cfg b/board/raspberrypi/genimage-raspberrypi0.cfg
deleted file mode 100644
index a9d4c4501f..0000000000
--- a/board/raspberrypi/genimage-raspberrypi0.cfg
+++ /dev/null
@@ -1,30 +0,0 @@
-image boot.vfat {
- vfat {
- files = {
- "bcm2708-rpi-b-plus.dtb",
- "rpi-firmware/bootcode.bin",
- "rpi-firmware/cmdline.txt",
- "rpi-firmware/config.txt",
- "rpi-firmware/fixup.dat",
- "rpi-firmware/start.elf",
- "zImage"
- }
- }
- size = 32M
-}
-
-image sdcard.img {
- hdimage {
- }
-
- partition boot {
- partition-type = 0xC
- bootable = "true"
- image = "boot.vfat"
- }
-
- partition rootfs {
- partition-type = 0x83
- image = "rootfs.ext4"
- }
-}
diff --git a/board/raspberrypi/genimage-raspberrypi0w.cfg b/board/raspberrypi/genimage-raspberrypi0w.cfg
deleted file mode 100644
index 3aafd9b6fc..0000000000
--- a/board/raspberrypi/genimage-raspberrypi0w.cfg
+++ /dev/null
@@ -1,31 +0,0 @@
-image boot.vfat {
- vfat {
- files = {
- "bcm2708-rpi-0-w.dtb",
- "rpi-firmware/bootcode.bin",
- "rpi-firmware/cmdline.txt",
- "rpi-firmware/config.txt",
- "rpi-firmware/fixup.dat",
- "rpi-firmware/start.elf",
- "rpi-firmware/overlays",
- "zImage"
- }
- }
- size = 32M
-}
-
-image sdcard.img {
- hdimage {
- }
-
- partition boot {
- partition-type = 0xC
- bootable = "true"
- image = "boot.vfat"
- }
-
- partition rootfs {
- partition-type = 0x83
- image = "rootfs.ext4"
- }
-}
diff --git a/board/raspberrypi/genimage-raspberrypi3-64.cfg b/board/raspberrypi/genimage-raspberrypi3-64.cfg
deleted file mode 100644
index 0d0ca750a7..0000000000
--- a/board/raspberrypi/genimage-raspberrypi3-64.cfg
+++ /dev/null
@@ -1,32 +0,0 @@
-image boot.vfat {
- vfat {
- files = {
- "bcm2710-rpi-3-b.dtb",
- "bcm2710-rpi-3-b-plus.dtb",
- "bcm2837-rpi-3-b.dtb",
- "rpi-firmware/bootcode.bin",
- "rpi-firmware/cmdline.txt",
- "rpi-firmware/config.txt",
- "rpi-firmware/fixup.dat",
- "rpi-firmware/start.elf",
- "Image"
- }
- }
- size = 32M
-}
-
-image sdcard.img {
- hdimage {
- }
-
- partition boot {
- partition-type = 0xC
- bootable = "true"
- image = "boot.vfat"
- }
-
- partition rootfs {
- partition-type = 0x83
- image = "rootfs.ext4"
- }
-}
diff --git a/board/raspberrypi/genimage-raspberrypi3.cfg b/board/raspberrypi/genimage-raspberrypi3.cfg
deleted file mode 100644
index 0a547241f4..0000000000
--- a/board/raspberrypi/genimage-raspberrypi3.cfg
+++ /dev/null
@@ -1,33 +0,0 @@
-image boot.vfat {
- vfat {
- files = {
- "bcm2710-rpi-3-b.dtb",
- "bcm2710-rpi-3-b-plus.dtb",
- "bcm2710-rpi-cm3.dtb",
- "rpi-firmware/bootcode.bin",
- "rpi-firmware/cmdline.txt",
- "rpi-firmware/config.txt",
- "rpi-firmware/fixup.dat",
- "rpi-firmware/start.elf",
- "rpi-firmware/overlays",
- "zImage"
- }
- }
- size = 32M
-}
-
-image sdcard.img {
- hdimage {
- }
-
- partition boot {
- partition-type = 0xC
- bootable = "true"
- image = "boot.vfat"
- }
-
- partition rootfs {
- partition-type = 0x83
- image = "rootfs.ext4"
- }
-}
diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index 70447cd48b..4042c5e9ac 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -4,9 +4,14 @@ set -e
BOARD_DIR="$(dirname $0)"
BOARD_NAME="$(basename ${BOARD_DIR})"
-GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARD_NAME}.cfg"
+GENIMAGE_CFG="${BOARD_DIR}/genimage-raspberrypi-generic.cfg"
GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+if [ -e ${BOARD_DIR}/${BOARD_NAME}.conf ]
+then
+ . ${BOARD_DIR}/${BOARD_NAME}.conf
+fi
+
for arg in "$@"
do
case "${arg}" in
@@ -49,6 +54,14 @@ __EOF__
done
+for i in ${!FILES[*]}
+do
+ FILES[$i]="\"${FILES[$i]}\","
+done
+SEDCMD_BOOTFILES=" -e 's/{BOOT_FILES}/${FILES[*]}/' "
+
+eval "sed ${SEDCMD_BOOTFILES} ${GENIMAGE_CFG}" > ${BUILD_DIR}/genimage.cfg
+
rm -rf "${GENIMAGE_TMP}"
genimage \
@@ -56,6 +69,6 @@ genimage \
--tmppath "${GENIMAGE_TMP}" \
--inputpath "${BINARIES_DIR}" \
--outputpath "${BINARIES_DIR}" \
- --config "${GENIMAGE_CFG}"
+ --config "${BUILD_DIR}/genimage.cfg"
exit $?
diff --git a/board/raspberrypi/raspberrypi.conf b/board/raspberrypi/raspberrypi.conf
new file mode 100644
index 0000000000..962cf726e2
--- /dev/null
+++ b/board/raspberrypi/raspberrypi.conf
@@ -0,0 +1,6 @@
+FILES=(
+ "bcm2708-rpi-b.dtb"
+ "bcm2708-rpi-b-plus.dtb"
+ "bcm2708-rpi-cm.dtb"
+ "zImage"
+)
diff --git a/board/raspberrypi/raspberrypi0.conf b/board/raspberrypi/raspberrypi0.conf
new file mode 100644
index 0000000000..132540b543
--- /dev/null
+++ b/board/raspberrypi/raspberrypi0.conf
@@ -0,0 +1,4 @@
+FILES=(
+ "bcm2708-rpi-b-plus.dtb"
+ "zImage"
+)
diff --git a/board/raspberrypi/raspberrypi0w.conf b/board/raspberrypi/raspberrypi0w.conf
new file mode 100644
index 0000000000..1ae60ed8fb
--- /dev/null
+++ b/board/raspberrypi/raspberrypi0w.conf
@@ -0,0 +1,5 @@
+FILES=(
+ "bcm2708-rpi-0-w.dtb"
+ "rpi-firmware/overlays"
+ "zImage"
+)
diff --git a/board/raspberrypi/raspberrypi2.conf b/board/raspberrypi/raspberrypi2.conf
new file mode 100644
index 0000000000..ea7d2402a6
--- /dev/null
+++ b/board/raspberrypi/raspberrypi2.conf
@@ -0,0 +1,4 @@
+FILES=(
+ "bcm2709-rpi-2-b.dtb"
+ "zImage"
+)
diff --git a/board/raspberrypi/raspberrypi3-64.conf b/board/raspberrypi/raspberrypi3-64.conf
new file mode 100644
index 0000000000..11cb88e191
--- /dev/null
+++ b/board/raspberrypi/raspberrypi3-64.conf
@@ -0,0 +1,6 @@
+FILES=(
+ "bcm2710-rpi-3-b.dtb"
+ "bcm2710-rpi-3-b-plus.dtb"
+ "bcm2837-rpi-3-b.dtb"
+ "Image"
+)
diff --git a/board/raspberrypi/raspberrypi3.conf b/board/raspberrypi/raspberrypi3.conf
new file mode 100644
index 0000000000..b3c5466fc2
--- /dev/null
+++ b/board/raspberrypi/raspberrypi3.conf
@@ -0,0 +1,7 @@
+FILES=(
+ "bcm2710-rpi-3-b.dtb"
+ "bcm2710-rpi-3-b-plus.dtb"
+ "bcm2710-rpi-cm3.dtb"
+ "rpi-firmware/overlays"
+ "zImage"
+)
--
2.11.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 2/8] board/raspberrypi: post-image --overlays option.
2019-01-29 13:23 [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 1/8] board/raspberrypi: Unify the genimage config files Robert J. Heywood
@ 2019-01-29 13:23 ` Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 3/8] board/raspberrypi: post-image, include .config dfs files Robert J. Heywood
` (6 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Robert J. Heywood @ 2019-01-29 13:23 UTC (permalink / raw)
To: buildroot
Pull the device tree overlays into the boot partition if the
--overlays option is set.
In addition, --add-pi3-miniuart-bt-overlay now implies --overlays.
Since the board conf files no longer need to explicitly declare
the overlays, the line including the overlays were removed from
raspberrypi0w.conf and raspberrypi3.conf
Signed-off-by: Robert J. Heywood <robert.heywood@codethink.co.uk>
---
board/raspberrypi/post-image.sh | 9 +++++++++
board/raspberrypi/raspberrypi0w.conf | 1 -
board/raspberrypi/raspberrypi3.conf | 1 -
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index 4042c5e9ac..5cc25a9ac6 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -6,6 +6,7 @@ BOARD_DIR="$(dirname $0)"
BOARD_NAME="$(basename ${BOARD_DIR})"
GENIMAGE_CFG="${BOARD_DIR}/genimage-raspberrypi-generic.cfg"
GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+INCLUDE_OVERLAYS=false
if [ -e ${BOARD_DIR}/${BOARD_NAME}.conf ]
then
@@ -23,8 +24,12 @@ do
# fixes rpi3 ttyAMA0 serial console
dtoverlay=pi3-miniuart-bt
__EOF__
+ INCLUDE_OVERLAYS=true
fi
;;
+ --overlays)
+ INCLUDE_OVERLAYS=true
+ ;;
--aarch64)
# Run a 64bits kernel (armv8)
sed -e '/^kernel=/s,=.*,=Image,' -i "${BINARIES_DIR}/rpi-firmware/config.txt"
@@ -54,6 +59,10 @@ __EOF__
done
+if $INCLUDE_OVERLAYS; then
+ FILES+=( "rpi-firmware/overlays" )
+fi
+
for i in ${!FILES[*]}
do
FILES[$i]="\"${FILES[$i]}\","
diff --git a/board/raspberrypi/raspberrypi0w.conf b/board/raspberrypi/raspberrypi0w.conf
index 1ae60ed8fb..27b4ec2399 100644
--- a/board/raspberrypi/raspberrypi0w.conf
+++ b/board/raspberrypi/raspberrypi0w.conf
@@ -1,5 +1,4 @@
FILES=(
"bcm2708-rpi-0-w.dtb"
- "rpi-firmware/overlays"
"zImage"
)
diff --git a/board/raspberrypi/raspberrypi3.conf b/board/raspberrypi/raspberrypi3.conf
index b3c5466fc2..51df913860 100644
--- a/board/raspberrypi/raspberrypi3.conf
+++ b/board/raspberrypi/raspberrypi3.conf
@@ -2,6 +2,5 @@ FILES=(
"bcm2710-rpi-3-b.dtb"
"bcm2710-rpi-3-b-plus.dtb"
"bcm2710-rpi-cm3.dtb"
- "rpi-firmware/overlays"
"zImage"
)
--
2.11.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 3/8] board/raspberrypi: post-image, include .config dfs files.
2019-01-29 13:23 [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 1/8] board/raspberrypi: Unify the genimage config files Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 2/8] board/raspberrypi: post-image --overlays option Robert J. Heywood
@ 2019-01-29 13:23 ` Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 4/8] board/raspberrypi: post-image, include .config kernel target Robert J. Heywood
` (5 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Robert J. Heywood @ 2019-01-29 13:23 UTC (permalink / raw)
To: buildroot
This change pulls dts filenames from the .config file instead of
specifying the required dts files in a board config file.
This reduces duplication and makes it possible to specify different
dts files in the config file to have it appear in the resultant
image. You would want to do so if you were using mainline kernel
sources.
The device tree declarations were removed from the board .conf files.
Signed-off-by: Robert J. Heywood <robert.heywood@codethink.co.uk>
---
board/raspberrypi/post-image.sh | 7 +++++++
board/raspberrypi/raspberrypi.conf | 3 ---
board/raspberrypi/raspberrypi0.conf | 1 -
board/raspberrypi/raspberrypi0w.conf | 1 -
board/raspberrypi/raspberrypi2.conf | 1 -
board/raspberrypi/raspberrypi3-64.conf | 3 ---
board/raspberrypi/raspberrypi3.conf | 3 ---
7 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index 5cc25a9ac6..900bf1eae2 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -63,6 +63,13 @@ if $INCLUDE_OVERLAYS; then
FILES+=( "rpi-firmware/overlays" )
fi
+# Pull device tree names from the .config file.
+eval `grep BR2_LINUX_KERNEL_INTREE_DTS_NAME .config`
+for dts in $BR2_LINUX_KERNEL_INTREE_DTS_NAME
+do
+ FILES+=( "$(basename $dts).dtb" )
+done
+
for i in ${!FILES[*]}
do
FILES[$i]="\"${FILES[$i]}\","
diff --git a/board/raspberrypi/raspberrypi.conf b/board/raspberrypi/raspberrypi.conf
index 962cf726e2..7b511fd0fc 100644
--- a/board/raspberrypi/raspberrypi.conf
+++ b/board/raspberrypi/raspberrypi.conf
@@ -1,6 +1,3 @@
FILES=(
- "bcm2708-rpi-b.dtb"
- "bcm2708-rpi-b-plus.dtb"
- "bcm2708-rpi-cm.dtb"
"zImage"
)
diff --git a/board/raspberrypi/raspberrypi0.conf b/board/raspberrypi/raspberrypi0.conf
index 132540b543..7b511fd0fc 100644
--- a/board/raspberrypi/raspberrypi0.conf
+++ b/board/raspberrypi/raspberrypi0.conf
@@ -1,4 +1,3 @@
FILES=(
- "bcm2708-rpi-b-plus.dtb"
"zImage"
)
diff --git a/board/raspberrypi/raspberrypi0w.conf b/board/raspberrypi/raspberrypi0w.conf
index 27b4ec2399..7b511fd0fc 100644
--- a/board/raspberrypi/raspberrypi0w.conf
+++ b/board/raspberrypi/raspberrypi0w.conf
@@ -1,4 +1,3 @@
FILES=(
- "bcm2708-rpi-0-w.dtb"
"zImage"
)
diff --git a/board/raspberrypi/raspberrypi2.conf b/board/raspberrypi/raspberrypi2.conf
index ea7d2402a6..7b511fd0fc 100644
--- a/board/raspberrypi/raspberrypi2.conf
+++ b/board/raspberrypi/raspberrypi2.conf
@@ -1,4 +1,3 @@
FILES=(
- "bcm2709-rpi-2-b.dtb"
"zImage"
)
diff --git a/board/raspberrypi/raspberrypi3-64.conf b/board/raspberrypi/raspberrypi3-64.conf
index 11cb88e191..6e810367d0 100644
--- a/board/raspberrypi/raspberrypi3-64.conf
+++ b/board/raspberrypi/raspberrypi3-64.conf
@@ -1,6 +1,3 @@
FILES=(
- "bcm2710-rpi-3-b.dtb"
- "bcm2710-rpi-3-b-plus.dtb"
- "bcm2837-rpi-3-b.dtb"
"Image"
)
diff --git a/board/raspberrypi/raspberrypi3.conf b/board/raspberrypi/raspberrypi3.conf
index 51df913860..7b511fd0fc 100644
--- a/board/raspberrypi/raspberrypi3.conf
+++ b/board/raspberrypi/raspberrypi3.conf
@@ -1,6 +1,3 @@
FILES=(
- "bcm2710-rpi-3-b.dtb"
- "bcm2710-rpi-3-b-plus.dtb"
- "bcm2710-rpi-cm3.dtb"
"zImage"
)
--
2.11.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 4/8] board/raspberrypi: post-image, include .config kernel target.
2019-01-29 13:23 [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Robert J. Heywood
` (2 preceding siblings ...)
2019-01-29 13:23 ` [Buildroot] [PATCH 3/8] board/raspberrypi: post-image, include .config dfs files Robert J. Heywood
@ 2019-01-29 13:23 ` Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 5/8] board/raspberrypi: post-image --file option Robert J. Heywood
` (4 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Robert J. Heywood @ 2019-01-29 13:23 UTC (permalink / raw)
To: buildroot
Read the .config file to find if either a zImage or an Image is
being built, and include them in the final fat volume if so.
This change means that the config files specific for each version
of the pi are now empty. So they are removed.
Signed-off-by: Robert J. Heywood <robert.heywood@codethink.co.uk>
---
board/raspberrypi/post-image.sh | 9 +++++++++
board/raspberrypi/raspberrypi.conf | 3 ---
board/raspberrypi/raspberrypi0.conf | 3 ---
board/raspberrypi/raspberrypi0w.conf | 3 ---
board/raspberrypi/raspberrypi2.conf | 3 ---
board/raspberrypi/raspberrypi3-64.conf | 3 ---
board/raspberrypi/raspberrypi3.conf | 3 ---
7 files changed, 9 insertions(+), 18 deletions(-)
delete mode 100644 board/raspberrypi/raspberrypi.conf
delete mode 100644 board/raspberrypi/raspberrypi0.conf
delete mode 100644 board/raspberrypi/raspberrypi0w.conf
delete mode 100644 board/raspberrypi/raspberrypi2.conf
delete mode 100644 board/raspberrypi/raspberrypi3-64.conf
delete mode 100644 board/raspberrypi/raspberrypi3.conf
diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index 900bf1eae2..c082dada3c 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -70,6 +70,15 @@ do
FILES+=( "$(basename $dts).dtb" )
done
+# Pull the kernel target from the .config file.
+eval `egrep '^BR2_LINUX_KERNEL_Z?IMAGE=y$' .config`
+if [ "${BR2_LINUX_KERNEL_IMAGE}" = 'y' ]; then
+ FILES+=( "Image" )
+fi
+if [ "${BR2_LINUX_KERNEL_ZIMAGE}" = 'y' ]; then
+ FILES+=( "zImage" )
+fi
+
for i in ${!FILES[*]}
do
FILES[$i]="\"${FILES[$i]}\","
diff --git a/board/raspberrypi/raspberrypi.conf b/board/raspberrypi/raspberrypi.conf
deleted file mode 100644
index 7b511fd0fc..0000000000
--- a/board/raspberrypi/raspberrypi.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-FILES=(
- "zImage"
-)
diff --git a/board/raspberrypi/raspberrypi0.conf b/board/raspberrypi/raspberrypi0.conf
deleted file mode 100644
index 7b511fd0fc..0000000000
--- a/board/raspberrypi/raspberrypi0.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-FILES=(
- "zImage"
-)
diff --git a/board/raspberrypi/raspberrypi0w.conf b/board/raspberrypi/raspberrypi0w.conf
deleted file mode 100644
index 7b511fd0fc..0000000000
--- a/board/raspberrypi/raspberrypi0w.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-FILES=(
- "zImage"
-)
diff --git a/board/raspberrypi/raspberrypi2.conf b/board/raspberrypi/raspberrypi2.conf
deleted file mode 100644
index 7b511fd0fc..0000000000
--- a/board/raspberrypi/raspberrypi2.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-FILES=(
- "zImage"
-)
diff --git a/board/raspberrypi/raspberrypi3-64.conf b/board/raspberrypi/raspberrypi3-64.conf
deleted file mode 100644
index 6e810367d0..0000000000
--- a/board/raspberrypi/raspberrypi3-64.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-FILES=(
- "Image"
-)
diff --git a/board/raspberrypi/raspberrypi3.conf b/board/raspberrypi/raspberrypi3.conf
deleted file mode 100644
index 7b511fd0fc..0000000000
--- a/board/raspberrypi/raspberrypi3.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-FILES=(
- "zImage"
-)
--
2.11.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 5/8] board/raspberrypi: post-image --file option
2019-01-29 13:23 [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Robert J. Heywood
` (3 preceding siblings ...)
2019-01-29 13:23 ` [Buildroot] [PATCH 4/8] board/raspberrypi: post-image, include .config kernel target Robert J. Heywood
@ 2019-01-29 13:23 ` Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 6/8] board/raspberrypi: post-image --rootfs option Robert J. Heywood
` (3 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Robert J. Heywood @ 2019-01-29 13:23 UTC (permalink / raw)
To: buildroot
Add a mechanism for adding files to the boot partition.
Usage: --file=example.txt
Signed-off-by: Robert J. Heywood <robert.heywood@codethink.co.uk>
---
board/raspberrypi/post-image.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index c082dada3c..7e39399187 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -55,6 +55,9 @@ __EOF__
gpu_mem="${arg:2}"
sed -e "/^${gpu_mem%=*}=/s,=.*,=${gpu_mem##*=}," -i "${BINARIES_DIR}/rpi-firmware/config.txt"
;;
+ --file=*)
+ FILES+=("${arg:7}")
+ ;;
esac
done
@@ -81,7 +84,7 @@ fi
for i in ${!FILES[*]}
do
- FILES[$i]="\"${FILES[$i]}\","
+ FILES[$i]=$(echo "\"${FILES[$i]}\"," | sed -e 's/[\/&]/\\&/g')
done
SEDCMD_BOOTFILES=" -e 's/{BOOT_FILES}/${FILES[*]}/' "
--
2.11.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 6/8] board/raspberrypi: post-image --rootfs option
2019-01-29 13:23 [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Robert J. Heywood
` (4 preceding siblings ...)
2019-01-29 13:23 ` [Buildroot] [PATCH 5/8] board/raspberrypi: post-image --file option Robert J. Heywood
@ 2019-01-29 13:23 ` Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 7/8] board/raspberrypi: post-image --skip-sdimg option Robert J. Heywood
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Robert J. Heywood @ 2019-01-29 13:23 UTC (permalink / raw)
To: buildroot
Add an option to change the rootfs. This option is useful if you would
like to create an image using something other than ext4.
Usage: --rootfs=example
Signed-off-by: Robert J. Heywood <robert.heywood@codethink.co.uk>
---
board/raspberrypi/genimage-raspberrypi-generic.cfg | 2 +-
board/raspberrypi/post-image.sh | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/board/raspberrypi/genimage-raspberrypi-generic.cfg b/board/raspberrypi/genimage-raspberrypi-generic.cfg
index 8bdd553a34..96020a5ddc 100644
--- a/board/raspberrypi/genimage-raspberrypi-generic.cfg
+++ b/board/raspberrypi/genimage-raspberrypi-generic.cfg
@@ -24,6 +24,6 @@ image sdcard.img {
partition rootfs {
partition-type = 0x83
- image = "rootfs.ext4"
+ image = "{ROOTFS}"
}
}
diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index 7e39399187..77118deafd 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -7,6 +7,7 @@ BOARD_NAME="$(basename ${BOARD_DIR})"
GENIMAGE_CFG="${BOARD_DIR}/genimage-raspberrypi-generic.cfg"
GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
INCLUDE_OVERLAYS=false
+ROOTFS="rootfs.ext4"
if [ -e ${BOARD_DIR}/${BOARD_NAME}.conf ]
then
@@ -58,6 +59,9 @@ __EOF__
--file=*)
FILES+=("${arg:7}")
;;
+ --rootfs=*)
+ ROOTFS="${arg:9}"
+ ;;
esac
done
@@ -87,8 +91,9 @@ do
FILES[$i]=$(echo "\"${FILES[$i]}\"," | sed -e 's/[\/&]/\\&/g')
done
SEDCMD_BOOTFILES=" -e 's/{BOOT_FILES}/${FILES[*]}/' "
+SEDCMD_ROOTFS=" -e 's/{ROOTFS}/${ROOTFS}/' "
-eval "sed ${SEDCMD_BOOTFILES} ${GENIMAGE_CFG}" > ${BUILD_DIR}/genimage.cfg
+eval "sed ${SEDCMD_BOOTFILES} ${SEDCMD_ROOTFS} ${GENIMAGE_CFG}" > ${BUILD_DIR}/genimage.cfg
rm -rf "${GENIMAGE_TMP}"
--
2.11.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 7/8] board/raspberrypi: post-image --skip-sdimg option
2019-01-29 13:23 [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Robert J. Heywood
` (5 preceding siblings ...)
2019-01-29 13:23 ` [Buildroot] [PATCH 6/8] board/raspberrypi: post-image --rootfs option Robert J. Heywood
@ 2019-01-29 13:23 ` Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 8/8] board/raspberrypi: post-image --kernel option Robert J. Heywood
2019-02-06 12:36 ` [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Arnout Vandecappelle
8 siblings, 0 replies; 14+ messages in thread
From: Robert J. Heywood @ 2019-01-29 13:23 UTC (permalink / raw)
To: buildroot
Add an option to disable the sd-card.img.
This is useful for when youre not building any compatible rootfs.
Signed-off-by: Robert J. Heywood <robert.heywood@codethink.co.uk>
---
board/raspberrypi/genimage-raspberrypi-generic.cfg | 2 ++
board/raspberrypi/post-image.sh | 6 +++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/board/raspberrypi/genimage-raspberrypi-generic.cfg b/board/raspberrypi/genimage-raspberrypi-generic.cfg
index 96020a5ddc..91f5039fb8 100644
--- a/board/raspberrypi/genimage-raspberrypi-generic.cfg
+++ b/board/raspberrypi/genimage-raspberrypi-generic.cfg
@@ -12,6 +12,7 @@ image boot.vfat {
size = 32M
}
+{SDIMG_START}
image sdcard.img {
hdimage {
}
@@ -27,3 +28,4 @@ image sdcard.img {
image = "{ROOTFS}"
}
}
+{SDIMG_END}
diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index 77118deafd..dbcaf3b1f8 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -8,6 +8,7 @@ GENIMAGE_CFG="${BOARD_DIR}/genimage-raspberrypi-generic.cfg"
GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
INCLUDE_OVERLAYS=false
ROOTFS="rootfs.ext4"
+SEDCMD_SDIMG=" -e '/{SDIMG_.*}/d' "
if [ -e ${BOARD_DIR}/${BOARD_NAME}.conf ]
then
@@ -62,6 +63,9 @@ __EOF__
--rootfs=*)
ROOTFS="${arg:9}"
;;
+ --skip-sdimg)
+ SEDCMD_SDIMG=" -e '/{SDIMG_START}/,/{SDIMG_END}/d' "
+ ;;
esac
done
@@ -93,7 +97,7 @@ done
SEDCMD_BOOTFILES=" -e 's/{BOOT_FILES}/${FILES[*]}/' "
SEDCMD_ROOTFS=" -e 's/{ROOTFS}/${ROOTFS}/' "
-eval "sed ${SEDCMD_BOOTFILES} ${SEDCMD_ROOTFS} ${GENIMAGE_CFG}" > ${BUILD_DIR}/genimage.cfg
+eval "sed ${SEDCMD_BOOTFILES} ${SEDCMD_ROOTFS} ${SEDCMD_SDIMG} ${GENIMAGE_CFG}" > ${BUILD_DIR}/genimage.cfg
rm -rf "${GENIMAGE_TMP}"
--
2.11.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 8/8] board/raspberrypi: post-image --kernel option
2019-01-29 13:23 [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Robert J. Heywood
` (6 preceding siblings ...)
2019-01-29 13:23 ` [Buildroot] [PATCH 7/8] board/raspberrypi: post-image --skip-sdimg option Robert J. Heywood
@ 2019-01-29 13:23 ` Robert J. Heywood
2019-02-06 12:36 ` [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Arnout Vandecappelle
8 siblings, 0 replies; 14+ messages in thread
From: Robert J. Heywood @ 2019-01-29 13:23 UTC (permalink / raw)
To: buildroot
Add an option to specify the kernel to boot.
This can be used to enable uboot on the pi.
Signed-off-by: Robert J. Heywood <robert.heywood@codethink.co.uk>
---
board/raspberrypi/post-image.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index dbcaf3b1f8..71d9857f09 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -66,6 +66,9 @@ __EOF__
--skip-sdimg)
SEDCMD_SDIMG=" -e '/{SDIMG_START}/,/{SDIMG_END}/d' "
;;
+ --kernel=*)
+ sed -e "/^kernel=/s,=.*,=${arg:9}," -i "${BINARIES_DIR}/rpi-firmware/config.txt"
+ ;;
esac
done
--
2.11.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations.
2019-01-29 13:23 [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Robert J. Heywood
` (7 preceding siblings ...)
2019-01-29 13:23 ` [Buildroot] [PATCH 8/8] board/raspberrypi: post-image --kernel option Robert J. Heywood
@ 2019-02-06 12:36 ` Arnout Vandecappelle
2019-02-08 11:41 ` Robert Heywood
8 siblings, 1 reply; 14+ messages in thread
From: Arnout Vandecappelle @ 2019-02-06 12:36 UTC (permalink / raw)
To: buildroot
Hi Robert,
Thank you for this work, excellent to see the raspberrypi support improved. We
discussed this at the Buildroot developer meeting.
However, we would like to suggest a slightly different approach that is more
amenable to reuse in other context and also simplifies things in general, we
think. See below for our thoughts and suggestions. Thus, the series is marked as
Changes Requested in patchwork.
On 29/01/2019 14:23, Robert J. Heywood wrote:
> Hi all.
>
> I wanted to do use u-boot and mainline kernel sources with my raspies
> but in trying to do so, found that doing it required a lot of changes
> to the genimage cfg files.
Note that the intention is actually that when you change the configuration of
your target, you also change the genimage.cfg file. That said, if it is easy to
support more use cases with a single genimage.cfg file (especially if there are
in-tree use cases as well), that is something we might want to support in the
provided genimage.cfg files.
> All the files were basically the same, and I found that they, and the
> post-image script define constants which are no longer correct if the
> corresponding options are changed in buildroot.
> (eg. BR2_LINUX_KERNEL_INTREE_DTS_NAME)
>
> I've improved the situation by first removing the replication in the
> cfg files (consolidating them into a single generic file). And then
> parsing the .config file for the board specific pieces; like the
> device tree files, and the kernel target (zimage vs image).
This .config approach we don't like. Instead, we think it is more appropriate
to add support for wildcards to genimage itself (and send that change upstream
to pengutronix as well). That way, you can add "*.dtb" to genimage.cfg instead
of the current board-specific names.
This approach can then be reused for other boards as well, like the freescale
boards on which you probably based this approach. Back in the day that approach
of a post-image script that autodiscovers things looked like the right thing to
do, but it is actually somewhat complicated and confusing.
>
> Then I added some new options;
> - Adding files to the boot partition,
> Allowing me to include uboot.bin.
If you want to do something like this, I really think it's more appropriate to
make a custom genimage.cfg and config.txt that includes everything you want.
Note that if you make a custom genimage.cfg, you also don't need to use the
raspberrypi post-image script. Instead, use support/scripts/genimage.sh as the
post-image script.
For the zImage vs. image, you could use "*mage" but I actually think it's more
appropriate to keep separate genimage.cfg files for them.
> - Changing the kernel in the config.txt file,
> Allowing me to boot uboot.bin.
Cfr. above.
In fact, I don't really like the way the post-image script is updating the
config.txt. I think it makes much more sense to have a different config.txt for
each board instead of SEDing it. There are two options to handle this: either
copy the board-specific config.txt in the post-image script, or (more
generically) extend support/scripts/genimage.cfg with options that point to
directories/files that have to be copied to IMAGES_DIR before running genimage.
> - Specifying a different rootfs file,
> Since i would like to use btrfs instead of ext4.
This one certainly is better done in a custom genimage.cfg.
> - An option to skip creating the full sdimg.
> As I'm using btrfs, in some cases I only need the vfat boot blob
> from genimage.
Again, make a custom genimage.cfg.
> There are a couple of aspects you might find questionable that I would
> welcome comments on;
>
> The script now modifies the generic genimage.cfg file and creates a
> temporary cfg file to be used with genimage. I've chosen to place
> the file at; ${BUILD_DIR}/genimage.cfg
> This might not be the best choice.
The freescale scripts now use mktemp, but actually I prefer your choice of
putting it in BUILD_DIR.
> I'm using a conbination of grep and eval to pull specific values out
> of the .config file and get them into the script. That might not be
> best practice.
I personally prefer to use 'make printvars VARS=...' because you can also
extract make-derived variables that way (e.g. LINUX_IMAGE_NAME to get the
zImage/image). But either way is fine.
Regards,
Arnout
> Maybe theres a cleaner way of accessing those variables?
>
> Kind regards,
> ~rob.
>
> Robert J. Heywood (8):
> board/raspberrypi: Unify the genimage config files
> board/raspberrypi: post-image --overlays option.
> board/raspberrypi: post-image, include .config dfs files.
> board/raspberrypi: post-image, include .config kernel target.
> board/raspberrypi: post-image --file option
> board/raspberrypi: post-image --rootfs option
> board/raspberrypi: post-image --skip-sdimg option
> board/raspberrypi: post-image --kernel option
>
> DEVELOPERS | 3 ++
> ...rrypi2.cfg => genimage-raspberrypi-generic.cfg} | 7 +--
> board/raspberrypi/genimage-raspberrypi.cfg | 32 ------------
> board/raspberrypi/genimage-raspberrypi0.cfg | 30 ------------
> board/raspberrypi/genimage-raspberrypi0w.cfg | 31 ------------
> board/raspberrypi/genimage-raspberrypi3-64.cfg | 32 ------------
> board/raspberrypi/genimage-raspberrypi3.cfg | 33 -------------
> board/raspberrypi/post-image.sh | 57 +++++++++++++++++++++-
> 8 files changed, 62 insertions(+), 163 deletions(-)
> rename board/raspberrypi/{genimage-raspberrypi2.cfg => genimage-raspberrypi-generic.cfg} (85%)
> delete mode 100644 board/raspberrypi/genimage-raspberrypi.cfg
> delete mode 100644 board/raspberrypi/genimage-raspberrypi0.cfg
> delete mode 100644 board/raspberrypi/genimage-raspberrypi0w.cfg
> delete mode 100644 board/raspberrypi/genimage-raspberrypi3-64.cfg
> delete mode 100644 board/raspberrypi/genimage-raspberrypi3.cfg
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations.
2019-02-06 12:36 ` [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Arnout Vandecappelle
@ 2019-02-08 11:41 ` Robert Heywood
2019-02-08 21:15 ` Arnout Vandecappelle
0 siblings, 1 reply; 14+ messages in thread
From: Robert Heywood @ 2019-02-08 11:41 UTC (permalink / raw)
To: buildroot
Hi Arnout.
Thanks for your reply.
In retrospect I probably should have reached out and asked if any of this would
be wanted prior to submitting it. c?est la vie.
On 06/02/2019 12:36, Arnout Vandecappelle wrote:
> Hi Robert,
>
> Thank you for this work, excellent to see the raspberrypi support improved. We
> discussed this at the Buildroot developer meeting.
>
> However, we would like to suggest a slightly different approach that is more
> amenable to reuse in other context and also simplifies things in general, we
> think. See below for our thoughts and suggestions. Thus, the series is marked as
> Changes Requested in patchwork.
>
> On 29/01/2019 14:23, Robert J. Heywood wrote:
>> Hi all.
>>
>> I wanted to do use u-boot and mainline kernel sources with my raspies
>> but in trying to do so, found that doing it required a lot of changes
>> to the genimage cfg files.
>
> Note that the intention is actually that when you change the configuration of
> your target, you also change the genimage.cfg file.
This is something that I found pretty confusing. It seems illogical to have to
set the same options in two distinct places.
> That said, if it is easy to
> support more use cases with a single genimage.cfg file (especially if there are
> in-tree use cases as well), that is something we might want to support in the
> provided genimage.cfg files.
>
It would be better if the genimage config file could contain a placeholder, such
as "devicetree" or "kernel" which could then be specified on the commandline.
Then when buildroot calls genimage, it could fill in the relevant parameters.
It would simplify a lot of the cfg files across all of the boards.
>> --snip--
>> I've improved the situation by first removing the replication in the
>> cfg files (consolidating them into a single generic file). And then
>> parsing the .config file for the board specific pieces; like the
>> device tree files, and the kernel target (zimage vs image).
>
> This .config approach we don't like. Instead, we think it is more appropriate
> to add support for wildcards to genimage itself (and send that change upstream
> to pengutronix as well). That way, you can add "*.dtb" to genimage.cfg instead
> of the current board-specific names.
>
genimage sort of already has this feature for directories. It's a shame we cant
use that feature here, since the pi's bootloader uses device trees in the root
of the partition. It would have been nice to have a dtb folder.
> This approach can then be reused for other boards as well, like the freescale
> boards on which you probably based this approach. Back in the day that approach
> of a post-image script that autodiscovers things looked like the right thing to
> do, but it is actually somewhat complicated and confusing.
I wasn't aware the freescale configs did something similar. That's pretty
interesting.
>
> If you want to do something like this, I really think it's more appropriate to
> make a custom genimage.cfg and config.txt that includes everything you want.
> Note that if you make a custom genimage.cfg, you also don't need to use the
> raspberrypi post-image script. Instead, use support/scripts/genimage.sh as the
> post-image script.
>
> For the zImage vs. image, you could use "*mage" but I actually think it's more
> appropriate to keep separate genimage.cfg files for them.
>
>> - Changing the kernel in the config.txt file,
>> Allowing me to boot uboot.bin.
>
> Cfr. above.
I was really hoping I'd be able to get away with not having to maintain a
separate set of files outside of buildroot that basically just replicate
functionality already inside of it.
But I guess what I could do is setup my CI such that it watches the buildroot
genimage.cfg files and alerts me if any incompatible changes happen.
>
> In fact, I don't really like the way the post-image script is updating the
> config.txt. I think it makes much more sense to have a different config.txt for
> each board instead of SEDing it. There are two options to handle this: either
> copy the board-specific config.txt in the post-image script, or (more
> generically) extend support/scripts/genimage.cfg with options that point to
> directories/files that have to be copied to IMAGES_DIR before running genimage.
I enjoy the sed approach. It means buildroot is able to take advantage of
upstream changes to the config.txt file, and we're not made to maintain a hoard
of copies with minor changes.
>
>> - Specifying a different rootfs file,
>> Since i would like to use btrfs instead of ext4.
>
> This one certainly is better done in a custom genimage.cfg.
>
>> - An option to skip creating the full sdimg.
>> As I'm using btrfs, in some cases I only need the vfat boot blob
>> from genimage.
>
> Again, make a custom genimage.cfg.
>
very well.
I have a script that configures buildroot as I want it, from defconfigs and
fragments. I'll also make it spit out a genimage file.
It'll be easy to do there since that script has access to the devicetree/kernel
variables from the defconfig anyway.
>
>> I'm using a conbination of grep and eval to pull specific values out
>> of the .config file and get them into the script. That might not be
>> best practice.
>
> I personally prefer to use 'make printvars VARS=...' because you can also
> extract make-derived variables that way (e.g. LINUX_IMAGE_NAME to get the
> zImage/image). But either way is fine.
I think I'll use that from now on. I find the eval approach confusing to look at. :)
kind regards, rob.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations.
2019-02-08 11:41 ` Robert Heywood
@ 2019-02-08 21:15 ` Arnout Vandecappelle
2019-02-11 11:17 ` Robert Heywood
0 siblings, 1 reply; 14+ messages in thread
From: Arnout Vandecappelle @ 2019-02-08 21:15 UTC (permalink / raw)
To: buildroot
On 08/02/2019 12:41, Robert Heywood wrote:
>
> Hi Arnout.
>
> Thanks for your reply.
> In retrospect I probably should have reached out and asked if any of this would
> be wanted prior to submitting it. c?est la vie.
>
> On 06/02/2019 12:36, Arnout Vandecappelle wrote:
>> ? Hi Robert,
>>
>> ? Thank you for this work, excellent to see the raspberrypi support improved. We
>> discussed this at the Buildroot developer meeting.
>>
>> ? However, we would like to suggest a slightly different approach that is more
>> amenable to reuse in other context and also simplifies things in general, we
>> think. See below for our thoughts and suggestions. Thus, the series is marked as
>> Changes Requested in patchwork.
>>
>> On 29/01/2019 14:23, Robert J. Heywood wrote:
>>> Hi all.
>>>
>>> I wanted to do use u-boot and mainline kernel sources with my raspies
>>> but in trying to do so, found that doing it required a lot of changes
>>> to the genimage cfg files.
>>
>> ? Note that the intention is actually that when you change the configuration of
>> your target, you also change the genimage.cfg file.
>
> This is something that I found pretty confusing. It seems illogical to have to
> set the same options in two distinct places.
True, but this patch series doesn't really change that, does it? E.g. for the
zImage/image kernel, you still have to select both the correct
BR2_LINUX_KERNEL_xxIMAGE option and pass --kernel= (rather than updating
config.txt).
>> That said, if it is easy to
>> support more use cases with a single genimage.cfg file (especially if there are
>> in-tree use cases as well), that is something we might want to support in the
>> provided genimage.cfg files.
>>
>
> It would be better if the genimage config file could contain a placeholder, such
> as "devicetree" or "kernel" which could then be specified on the commandline.
> Then when buildroot calls genimage, it could fill in the relevant parameters.
That is indeed a good idea! Maybe both better and easier to implement than
wildcard support in genimage...
>
> It would simplify a lot of the cfg files across all of the boards.
>
>>> --snip--
>>> I've improved the situation by first removing the replication in the
>>> cfg files (consolidating them into a single generic file). And then
>>> parsing the .config file for the board specific pieces; like the
>>> device tree files, and the kernel target (zimage vs image).
>>
>> ? This .config approach we don't like. Instead, we think it is more appropriate
>> to add support for wildcards to genimage itself (and send that change upstream
>> to pengutronix as well). That way, you can add "*.dtb" to genimage.cfg instead
>> of the current board-specific names.
>>
>
> genimage sort of already has this feature for directories. It's a shame we cant
> use that feature here, since the pi's bootloader uses device trees in the root
> of the partition. It would have been nice to have a dtb folder.
>
>> ? This approach can then be reused for other boards as well, like the freescale
>> boards on which you probably based this approach. Back in the day that approach
>> of a post-image script that autodiscovers things looked like the right thing to
>> do, but it is actually somewhat complicated and confusing.
>
> I wasn't aware the freescale configs did something similar. That's pretty
> interesting.
>
>>
>> ? If you want to do something like this, I really think it's more appropriate to
>> make a custom genimage.cfg and config.txt that includes everything you want.
>> Note that if you make a custom genimage.cfg, you also don't need to use the
>> raspberrypi post-image script. Instead, use support/scripts/genimage.sh as the
>> post-image script.
>>
>> ? For the zImage vs. image, you could use "*mage" but I actually think it's more
>> appropriate to keep separate genimage.cfg files for them.
>>
>>> - Changing the kernel in the config.txt file,
>>> ?? Allowing me to boot uboot.bin.
>>
>> ? Cfr. above.
>
> I was really hoping I'd be able to get away with not having to maintain a
> separate set of files outside of buildroot that basically just replicate
> functionality already inside of it.
> But I guess what I could do is setup my CI such that it watches the buildroot
> genimage.cfg files and alerts me if any incompatible changes happen.
>
>>
>> ? In fact, I don't really like the way the post-image script is updating the
>> config.txt. I think it makes much more sense to have a different config.txt for
>> each board instead of SEDing it. There are two options to handle this: either
>> copy the board-specific config.txt in the post-image script, or (more
>> generically) extend support/scripts/genimage.cfg with options that point to
>> directories/files that have to be copied to IMAGES_DIR before running genimage.
>
> I enjoy the sed approach. It means buildroot is able to take advantage of
> upstream changes to the config.txt file, and we're not made to maintain a hoard
> of copies with minor changes.
Only, config.txt doesn't come from upstream; it comes from
package/rpi-firmware/config.txt and it says "we recommend you to change it to
fit your needs".
Okay, it goes on saying to override it in a post-build script, but that's
because there is no other way to put a file into genimage.cfg.
Regards,
Arnout
>>> - Specifying a different rootfs file,
>>> ?? Since i would like to use btrfs instead of ext4.
>>
>> ? This one certainly is better done in a custom genimage.cfg.
>>
>>> - An option to skip creating the full sdimg.
>>> ?? As I'm using btrfs, in some cases I only need the vfat boot blob
>>> ?? from genimage.
>>
>> ? Again, make a custom genimage.cfg.
>>
>
> very well.
>
> I have a script that configures buildroot as I want it, from defconfigs and
> fragments. I'll also make it spit out a genimage file.
> It'll be easy to do there since that script has access to the devicetree/kernel
> variables from the defconfig anyway.
>
>
>>
>>> I'm using a conbination of grep and eval to pull specific values out
>>> of the .config file and get them into the script. That might not be
>>> best practice.
>>
>> ? I personally prefer to use 'make printvars VARS=...' because you can also
>> extract make-derived variables that way (e.g. LINUX_IMAGE_NAME to get the
>> zImage/image). But either way is fine.
>
> I think I'll use that from now on. I find the eval approach confusing to look
> at. :)
>
> kind regards, rob.
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations.
2019-02-08 21:15 ` Arnout Vandecappelle
@ 2019-02-11 11:17 ` Robert Heywood
2019-02-11 18:21 ` Yann E. MORIN
0 siblings, 1 reply; 14+ messages in thread
From: Robert Heywood @ 2019-02-11 11:17 UTC (permalink / raw)
To: buildroot
On 08/02/2019 21:15, Arnout Vandecappelle wrote:
>
>>
>>>
>>>> Hi all.
>>>>
>>>> I wanted to do use u-boot and mainline kernel sources with my raspies
>>>> but in trying to do so, found that doing it required a lot of changes
>>>> to the genimage cfg files.
>>>
>>> ? Note that the intention is actually that when you change the configuration of
>>> your target, you also change the genimage.cfg file.
>>
>> This is something that I found pretty confusing. It seems illogical to have to
>> set the same options in two distinct places.
>
> True, but this patch series doesn't really change that, does it? E.g. for the
> zImage/image kernel, you still have to select both the correct
> BR2_LINUX_KERNEL_xxIMAGE option and pass --kernel= (rather than updating
> config.txt).
>
No. Not for the kernel. I could have changed that, but the script already does
some level of faffing with the "kernel=" option. And I decided it would be
better to not change the script's behaviour for that option, in case anyone were
depending on that particular behaviour.
I was referring to the device trees. Which are first defined in the .config, and
then have to be redefined in each genimage.cfg.
>>>
>>> ? In fact, I don't really like the way the post-image script is updating the
>>> config.txt. I think it makes much more sense to have a different config.txt for
>>> each board instead of SEDing it. There are two options to handle this: either
>>> copy the board-specific config.txt in the post-image script, or (more
>>> generically) extend support/scripts/genimage.cfg with options that point to
>>> directories/files that have to be copied to IMAGES_DIR before running genimage.
>>
>> I enjoy the sed approach. It means buildroot is able to take advantage of
>> upstream changes to the config.txt file, and we're not made to maintain a hoard
>> of copies with minor changes.
>
> Only, config.txt doesn't come from upstream; it comes from
> package/rpi-firmware/config.txt and it says "we recommend you to change it to
> fit your needs".
>
> Okay, it goes on saying to override it in a post-build script, but that's
> because there is no other way to put a file into genimage.cfg.
>
The package/rpi-firmware/config.txt file is downloaded from the raspberrypi
github. While its true that the file won't change without someone updating the
commit in the respective .mk file, its not a file that buildroot maintains or
authored. It is being pulled from upstream.
If you really wanted to keep separate versions of config.txt around for each
board, genimage does support renaming files as it copies them into the image.
You could feasibly add a line such as this to each cfg file;
file config.txt { image = "board/raspberrypi/config_raspberrypi0w.txt" }
>
> Regards,
> Arnout
>
kind regards, rob.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations.
2019-02-11 11:17 ` Robert Heywood
@ 2019-02-11 18:21 ` Yann E. MORIN
0 siblings, 0 replies; 14+ messages in thread
From: Yann E. MORIN @ 2019-02-11 18:21 UTC (permalink / raw)
To: buildroot
Robert, All,
On 2019-02-11 11:17 +0000, Robert Heywood spake thusly:
> On 08/02/2019 21:15, Arnout Vandecappelle wrote:
> > Only, config.txt doesn't come from upstream; it comes from
> >package/rpi-firmware/config.txt and it says "we recommend you to change it to
> >fit your needs".
> >
> > Okay, it goes on saying to override it in a post-build script, but that's
> >because there is no other way to put a file into genimage.cfg.
> >
> The package/rpi-firmware/config.txt file is downloaded from the raspberrypi
> github. While its true that the file won't change without someone updating
> the commit in the respective .mk file,
Absolutely not. The config.txt file *is* bundled in Buildroot.
> its not a file that buildroot
> maintains or authored. It is being pulled from upstream.
Yes it is, just do: "git log package/rpi-firmware/config.txt" and
you'll see that it is a file we have had since the inception of the
rpi-firmware package in Buildroot.
We may have used the upstream one as inspirtion, though.
> If you really wanted to keep separate versions of config.txt around for each
> board, genimage does support renaming files as it copies them into the
> image.
> You could feasibly add a line such as this to each cfg file;
> file config.txt { image = "board/raspberrypi/config_raspberrypi0w.txt" }
Actually, I think this is a very good idea. But that is just my
position, others may disagree...
Again, you have to recognise that the defconfig files we have in
Buildroot are just basic configurations and setups, that are there just
to help one bootstrap a local build for a custom project/hobby/...
Again, my position is that, if one's project/hobby/... needs a custom
linux/uboot/firmware/etc... config file, then one should handle it
locally, using the files in Buildroot as inspiration.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2019-02-11 18:21 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-29 13:23 [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 1/8] board/raspberrypi: Unify the genimage config files Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 2/8] board/raspberrypi: post-image --overlays option Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 3/8] board/raspberrypi: post-image, include .config dfs files Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 4/8] board/raspberrypi: post-image, include .config kernel target Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 5/8] board/raspberrypi: post-image --file option Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 6/8] board/raspberrypi: post-image --rootfs option Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 7/8] board/raspberrypi: post-image --skip-sdimg option Robert J. Heywood
2019-01-29 13:23 ` [Buildroot] [PATCH 8/8] board/raspberrypi: post-image --kernel option Robert J. Heywood
2019-02-06 12:36 ` [Buildroot] [PATCH 0/8] board/raspberrypi: post-image customisations Arnout Vandecappelle
2019-02-08 11:41 ` Robert Heywood
2019-02-08 21:15 ` Arnout Vandecappelle
2019-02-11 11:17 ` Robert Heywood
2019-02-11 18:21 ` Yann E. MORIN
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.