Skip to contentSkip to conversation

board/ci20: Implement creation of a basic sdcard image for ci20

PATCH New Johannes Schmitz 2 participants 2 messages Jan 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 board/ci20: Implement creation of a basic sdcard image for ci20

Add a genimage.cfg and post-image.sh to create a working sdcard.img for the ci20 hardware. We also need a uboot-env.txt to create the partition for the uboot environment.

Update the board/ci20/readme.txt with the related information. Remove the tftp netboot description from the readme as it is already to complicated for a basic bootable example.

---
 board/ci20/genimage.cfg  | 29 ++++++++++++++++++++++++++
 board/ci20/post-image.sh | 16 +++++++++++++++
 board/ci20/readme.txt    | 53 +++++++++++++++++++++++-------------------------
 board/ci20/uboot-env.txt |  9 ++++++++
 configs/ci20_defconfig   | 18 +++++++---------
 5 files changed, 86 insertions(+), 39 deletions(-)
 create mode 100644 board/ci20/genimage.cfg
 create mode 100755 board/ci20/post-image.sh
 create mode 100644 board/ci20/uboot-env.txt
board/ci20/genimage.cfg new file +29 -0
new file mode 100644
index 0000000..72fcadb
@@ -0,0 +1,29 @@
+image sdcard.img {
+    hdimage {
+    }
+
+    partition uboot-spl {
+        in-partition-table = "no"
+        image = "u-boot-spl.bin"
+        offset = 512
+    }
+
+    partition uboot {
+        in-partition-table = "no"
+        image = "u-boot.img"
+        offset = 14k
+    }
+
+    partition uboot-env {
+        in-partition-table = "no"
+        image = "uboot-env.bin"
+        offset = 526k
+    }
+
+    partition rootfs {
+        partition-type = 0x83
+        image = "rootfs.ext4"
+        offset = 2M
+        size = 70M
+    }
+}
board/ci20/post-image.sh new file +16 -0
new file mode 100755
index 0000000..c82b189
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                               \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+exit $?
board/ci20/readme.txt +25 -28

66 lines not on this page · raw message

board/ci20/uboot-env.txt new file +9 -0
new file mode 100644
index 0000000..ae4d49f
@@ -0,0 +1,9 @@
+baudrate=115200
+board_mfr=NP
+bootargs=console=ttyS4,115200 console=tty0 mem=256M at 0x0 mem=768M at 0x30000000 rootwait root=/dev/mmcblk0p1 devtmpfs.mount=1 ip=dhcp
+bootcmd=run ethargs; ext4load mmc 0:1 0x88000000 /boot/uImage; bootm 0x88000000
+bootdelay=1
+loads_echo=1
+stderr=eserial0,eserial4
+stdin=eserial0,eserial4
+stdout=eserial0,eserial4
configs/ci20_defconfig +7 -11
index 6de6394..fddd84a 100644
@@ -1,28 +1,24 @@
-# architecture
 BR2_mipsel=y
 BR2_mips_xburst=y
 # BR2_MIPS_SOFT_FLOAT is not set
-
-# Linux headers same as kernel, a 3.18 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_18=y
-
-# system
 BR2_TARGET_GENERIC_GETTY_PORT="ttyS4"
-
-# kernel
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/ci20/post-image.sh"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/MIPS/CI20_linux.git"
 BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="7dff33297116643485ca37141d804eddd793e834"
 BR2_LINUX_KERNEL_DEFCONFIG="ci20"
-
-# u-boot
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+# BR2_TARGET_ROOTFS_TAR is not set
 BR2_TARGET_UBOOT=y
-BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY=y
 BR2_TARGET_UBOOT_BOARDNAME="ci20_mmc"
 BR2_TARGET_UBOOT_CUSTOM_GIT=y
 BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/MIPS/CI20_u-boot"
 BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="dd3c1b95dac7d10b2ca5806f65e5c1050d7dd0fa"
 BR2_TARGET_UBOOT_FORMAT_IMG=y
 BR2_TARGET_UBOOT_SPL=y
-BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin"
+BR2_TARGET_UBOOT_ENVIMAGE=y
+BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 board/ci20: Implement creation of a basic sdcard image for ci20

Hello,

Quoted 9 lines · Johannes Schmitz

Add a genimage.cfg and post-image.sh to create a working sdcard.img for the ci20 hardware. We also need a uboot-env.txt to create the partition for the uboot environment.

Update the board/ci20/readme.txt with the related information. Remove the tftp netboot description from the readme as it is already to complicated for a basic bootable example.

Thanks for working on this!

board/ci20/genimage.cfg line 27

Quoted 5 lines
board/ci20/genimage.cfg new file +5 -0
+    partition rootfs {
+        partition-type = 0x83
+        image = "rootfs.ext4"
+        offset = 2M
+        size = 70M

70 MB ? Why ? This looks like a very odd size.

Quoted 12 lines
board/ci20/post-image.sh new file +6 -0
new file mode 100755
index 0000000..c82b189
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+

board/ci20/post-image.sh line 16

Quoted 10 lines
board/ci20/post-image.sh new file +10 -0
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                               \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+exit $?

Please use support/scripts/genimage.sh instead, it does exactly the same thing. You can directly use it as the post-image script.

board/ci20/readme.txt line 7

Quoted 11 lines
board/ci20/readme.txt +0 -3
index ca7bb52..9dfbb88 100644
@@ -2,41 +2,38 @@
 * MIPS Creator CI20 *
 *********************
 
-The 'ci20_defconfig' will create a root filesystem and a kernel image
-under the 'output/images/' directory. This document will try to explain how
-to use them in order to run Buildroot in the MIPS Creator CI20 board.

Why do you remove this paragraph ?

Quoted 6 lines
board/ci20/uboot-env.txt new file +0 -0
new file mode 100644
index 0000000..ae4d49f

board/ci20/uboot-env.txt line 9

Quoted 9 lines
board/ci20/uboot-env.txt new file +9 -0
@@ -0,0 +1,9 @@
+baudrate=115200
+board_mfr=NP
+bootargs=console=ttyS4,115200 console=tty0 mem=256M at 0x0 mem=768M at 0x30000000 rootwait root=/dev/mmcblk0p1 devtmpfs.mount=1 ip=dhcp
+bootcmd=run ethargs; ext4load mmc 0:1 0x88000000 /boot/uImage; bootm 0x88000000
+bootdelay=1
+loads_echo=1
+stderr=eserial0,eserial4
+stdin=eserial0,eserial4
+stdout=eserial0,eserial4

Where is this file being used ?

configs/ci20_defconfig line 6

Quoted 11 lines
configs/ci20_defconfig +0 -3
index 6de6394..fddd84a 100644
@@ -1,28 +1,24 @@
-# architecture
 BR2_mipsel=y
 BR2_mips_xburst=y
 # BR2_MIPS_SOFT_FLOAT is not set
-
-# Linux headers same as kernel, a 3.18 series

It would be nice to keep the comment. Many of our defconfigs are not generated directly by "make savedefconfig", but hand-edited. It would be nice to continue this practice.

Quoted 18 lines
configs/ci20_defconfig +5 -6
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_18=y
-
-# system
 BR2_TARGET_GENERIC_GETTY_PORT="ttyS4"
-
-# kernel
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/ci20/post-image.sh"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/MIPS/CI20_linux.git"
 BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="7dff33297116643485ca37141d804eddd793e834"
 BR2_LINUX_KERNEL_DEFCONFIG="ci20"
-
-# u-boot
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+# BR2_TARGET_ROOTFS_TAR is not set

configs/ci20_defconfig line 23

Quoted 10 lines
configs/ci20_defconfig +1 -2
 BR2_TARGET_UBOOT=y
-BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY=y
 BR2_TARGET_UBOOT_BOARDNAME="ci20_mmc"
 BR2_TARGET_UBOOT_CUSTOM_GIT=y
 BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/MIPS/CI20_u-boot"
 BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="dd3c1b95dac7d10b2ca5806f65e5c1050d7dd0fa"
 BR2_TARGET_UBOOT_FORMAT_IMG=y
 BR2_TARGET_UBOOT_SPL=y
-BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin"
+BR2_TARGET_UBOOT_ENVIMAGE=y

envimage, but you don't specify the path to the environment file? This looks odd.

configs/ci20_defconfig line 24

Quoted 1 line
configs/ci20_defconfig +1 -0
+BR2_PACKAGE_HOST_GENIMAGE=y

Thanks!

Thomas

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