* [ptxdist] [PATCH 2/3] Allow creation of bootable SD card for OMAP CPUs
2012-04-25 14:18 [ptxdist] [PATCH 1/3] Add host-parted Bernhard Walle
@ 2012-04-25 14:18 ` Bernhard Walle
2012-04-25 14:18 ` [ptxdist] [PATCH 3/3 v2] fontconfig: Fix Darwin build Bernhard Walle
1 sibling, 0 replies; 3+ messages in thread
From: Bernhard Walle @ 2012-04-25 14:18 UTC (permalink / raw)
To: ptxdist; +Cc: Bernhard Walle
With the new option IMAGE_OMAPSD it's possible to create an image for
OMAP-bootable SD cards. Tested with a devkit8000 and a virtual beagle
board (qemu).
See the comment in platforms/image_omapsd.in for more information.
Signed-off-by: Bernhard Walle <walle@corscience.de>
---
platforms/image_omapsd.in | 48 +++++++++++
rules/post/image_omapsd.make | 33 ++++++++
scripts/genomapsdimg | 188 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 269 insertions(+)
create mode 100644 platforms/image_omapsd.in
create mode 100644 rules/post/image_omapsd.make
create mode 100755 scripts/genomapsdimg
diff --git a/platforms/image_omapsd.in b/platforms/image_omapsd.in
new file mode 100644
index 0000000..ef6c5e4
--- /dev/null
+++ b/platforms/image_omapsd.in
@@ -0,0 +1,48 @@
+## SECTION=image
+
+menuconfig IMAGE_OMAPSD
+ bool
+ select IMAGE_VFAT_TOOLS
+ select HOST_PARTED
+ select IMAGE_EXT2
+ depends on ARCH_ARM
+ prompt "Generate OMAP bootable SD card"
+ help
+ Creates an bootable SD card for OMAP CPUs, for example for the beagle board.
+ The resulting image is called "omap_sd.img". You can copy it with "dd"
+ on a raw SD card, without partitioning.
+
+ The SD card contains two file systems:
+ 1) A FAT file system that contains MLO, a bootloader and a Linux kernel
+ (plus additional files like an initramfs).
+ 2) The root file system as ext3 file system.
+
+ OMAP has special requirements regarding the geometry of partition table,
+ and the location of MLO, that's why a fixed image makes more sense here
+ than copying the files manually.
+
+if IMAGE_OMAPSD
+
+config IMAGE_OMAPSD_BOOTLOADER
+ string
+ default "u-boot.img"
+ prompt "Bootloader file"
+ help
+ The name of the bootloader that should be copied to the SD card. If you use
+ u-boot SPL, then "u-boot.img" is the right choice here. If you still use
+ x-loader, then "u-boot.bin" should be copied. Also barebox can be used
+ with its MLO. The file must reside in the images directory of the platform.
+
+config IMAGE_OMAPSD_ADDITIONAL_BOOT_FILES
+ string
+ default ""
+ prompt "Additional files for the boot partition"
+ help
+ A (whitespace separated) list of additional files can be specified here.
+ The files get copied in the boot partition (1st FAT partition). They must
+ be in the images/ directory of the platform that is built. One example is
+ a uRamdisk that gets loaded by the bootloader.
+
+endif
+
+# vim: set sw=8 ts=8 noet ft=kconfig:
diff --git a/rules/post/image_omapsd.make b/rules/post/image_omapsd.make
new file mode 100644
index 0000000..5131b40
--- /dev/null
+++ b/rules/post/image_omapsd.make
@@ -0,0 +1,33 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2012 by Bernhard Walle <walle@corscience.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+SEL_ROOTFS-$(PTXCONF_IMAGE_OMAPSD) += $(IMAGEDIR)/omap_sd.img
+
+# preprend the $(IMAGEDIR) if PTXCONF_IMAGE_OMAPSD_ADDITIONAL_BOOT_FILES is not
+# empty
+ifneq ($(PTXCONF_IMAGE_OMAPSD_ADDITIONAL_BOOT_FILES),"")
+PTXCONF_IMAGE_OMAPSD_ADDITIONAL_BOOT_FILES_FULL := \
+ $(addprefix $(IMAGEDIR)/, $(PTXCONF_IMAGE_OMAPSD_ADDITIONAL_BOOT_FILES))
+endif
+
+$(IMAGEDIR)/omap_sd.img: $(IMAGEDIR)/root.ext2
+ @ln -sf $(IMAGEDIR)/linuximage $(IMAGEDIR)/uImage
+ @echo "Creating bootable SD card for OMAP"; \
+ PATH=$(PTXCONF_SYSROOT_HOST)/bin:$$PATH $(PTXDIST_TOPDIR)/scripts/genomapsdimg \
+ -m $(IMAGEDIR)/MLO \
+ -b $(IMAGEDIR)/$(PTXCONF_IMAGE_OMAPSD_BOOTLOADER) \
+ -k $(IMAGEDIR)/uImage \
+ -f $(IMAGEDIR)/root.ext2 \
+ -a "$(PTXCONF_IMAGE_OMAPSD_ADDITIONAL_BOOT_FILES_FULL)" \
+ -o $@
+ @echo "done."
+ @rm -f $(IMAGEDIR)/uImage
+
+# vim: syntax=make
diff --git a/scripts/genomapsdimg b/scripts/genomapsdimg
new file mode 100755
index 0000000..cd48fd5
--- /dev/null
+++ b/scripts/genomapsdimg
@@ -0,0 +1,188 @@
+#!/bin/bash
+#
+# Copyright (C) 2011 by Bernhard Walle <walle@corscience.de>
+#
+# Creates a OMAP bootable SD card.
+# The image has a PC-style partition table with two partitions:
+#
+# 1) a FAT partition with MLO, bootloader and a Linux kernel
+# 2) a ext3 partition with the root file system.
+#
+# That's a bit tricky because the OMAP needs a special partition table
+# (therefore, genpart cannot be used).
+#
+# Parts of the script have been copied from 'debian-cd' (post-boot-armel).
+
+usage() {
+cat <<-EOF
+
+Usage: `basename "$0"` OPTIONS
+
+ -h this help
+ -m <mlo> path to the MLO file (SPL)
+ -b <bootloader> path to the bootloader
+ -k <kernel> path to the linux kernel
+ -a <file> additional file that should be included in the FAT partition
+ (e.g. a FTD or an initramfs). Multiple files can be specified
+ using whitespace separation. Don't forget to quote.
+ -f <filesystem> the (ext3) file system image for the second partition
+ -o <output> the output file that should be written
+
+EOF
+}
+
+error()
+{
+ echo >&2 "$@"
+ exit 1
+}
+
+file_length()
+{
+ stat -c %s "$1"
+}
+
+create_partitions()
+{
+ local boot_size="$((72 * 1024 * 1024))" # 72 MB for the partition
+ local image_size="$(file_length "${FILESYSTEM}")"
+ local img_size_blocks="$(((${boot_size} + ${image_size} + 512 - 1) / 512))"
+
+ dd if=/dev/zero of="${OUTPUT}" bs=512 count=0 seek="${img_size_blocks}" >/dev/null 2>&1
+ if [ $? -ne 0 ] ; then
+ error "Unable to create '${OUTPUT}' with 'dd'"
+ fi
+
+ local trg_size="$(file_length "${OUTPUT}")"
+ local cylinders=$(( ${trg_size}/255/63/512 ))
+
+ {
+ echo ,9,0x0C,*
+ echo ,,,-
+ } | sfdisk -D -H 255 -S 63 -C ${cylinders} "${OUTPUT}" >/dev/null 2>&1
+
+ if [ $? -ne 0 ] ; then
+ error "Unable to execute sfdisk"
+ fi
+}
+
+check_input()
+{
+ if ! [ -r "${MLO}" ] ; then
+ echo "MLO '${MLO}' does not exist."
+ usage
+ exit 1
+ fi
+
+ if ! [ -r "${BOOTLOADER}" ] ; then
+ echo "Bootloader '${BOOTLOADER}' does not exist."
+ usage
+ exit 1
+ fi
+
+ if ! [ -r "${KERNEL}" ] ; then
+ echo "Kernel '${KERNEL}' does not exist."
+ usage
+ exit 1
+ fi
+
+ if ! [ -r "${FILESYSTEM}" ] ; then
+ echo "File system image '${FILESYSTEM}' does not exist."
+ usage
+ exit 1
+ fi
+
+ if [ -z "${OUTPUT}" ] ; then
+ echo "You have to specify an output file with -o."
+ usage
+ exit 1
+ fi
+}
+
+create_filesystem()
+{
+ local vatstart=$(parted "${OUTPUT}" unit B print 2>/dev/null|grep "^ 1"|awk '{print $2}')
+ local vatsize=$(LANG=C fdisk -l "${OUTPUT}" 2>/dev/null|grep W95 |awk '{print $5}')
+
+ if ! mkdosfs -F 32 -C "${OUTPUT_FAT}" "${vatsize}" >/dev/null 2>&1 ; then
+ error "Unable to create '${OUTPUT_FAT}' via 'mkdosfs'"
+ fi
+}
+
+copy_files()
+{
+ export MTOOLS_SKIP_CHECK=1
+
+ # it's important to copy the MLO first
+ mcopy -i "${OUTPUT_FAT}" "${MLO}" ::MLO
+ mcopy -i "${OUTPUT_FAT}" "${BOOTLOADER}" "::$(basename "${BOOTLOADER}")"
+ mcopy -i "${OUTPUT_FAT}" "${KERNEL}" "::$(basename "${KERNEL}")"
+
+ # copy additional files (like FTD or an initramfs)
+ if [ -n "$ADDITIONAL_FILES" ] ; then
+ for file in ${ADDITIONAL_FILES} ; do
+ local targetname=$(basename "${file}")
+ if ! mcopy -i "${OUTPUT_FAT}" "${file}" "::${targetname}" ; then
+ error "Unable to copy '${file}' to '${OUTPUT_FAT}'"
+ fi
+ done
+ fi
+}
+
+create_image()
+{
+ # now put the whole vfat into the first partition
+ local vatstart=$(parted "${OUTPUT}" unit B print 2>/dev/null | grep "^ 1" | awk '{print $2}')
+
+ dd conv=notrunc bs="${vatstart%B}" if="${OUTPUT_FAT}" of="${OUTPUT}" seek=1 >/dev/null 2>&1
+ if [ $? -ne 0 ] ; then
+ error "Unable to append '${OUTPUT_FAT}' to '${OUTPUT}'"
+ fi
+ rm "${OUTPUT_FAT}"
+
+ # put ext3 content into the second partition
+ local ext3start=$(parted "${OUTPUT}" unit B print 2>/dev/null | grep "^ 2" | awk '{print $2}')
+ dd conv=notrunc bs="${ext3start%B}" if="${FILESYSTEM}" of="${OUTPUT}" seek=1 >/dev/null 2>&1
+ if [ $? -ne 0 ] ; then
+ error "Unable to append '${FILESYSTEM}' to '${OUTPUT}'"
+ fi
+}
+
+
+# command line parsing
+
+while getopts hm:b:k:a:f:o: name ; do
+ case $name in
+ m) MLO="${OPTARG}"
+ ;;
+ b) BOOTLOADER="${OPTARG}"
+ ;;
+ k) KERNEL="${OPTARG}"
+ ;;
+ a) ADDITIONAL_FILES="${OPTARG}"
+ ;;
+ f) FILESYSTEM="${OPTARG}"
+ ;;
+ o) OUTPUT="${OPTARG}"
+ ;;
+ h) usage
+ exit 0
+ ;;
+ *) usage
+ exit 1
+ ;;
+ esac
+done
+
+OUTPUT_FAT="${OUTPUT}.vfat"
+[ -r "${OUTPUT_FAT}" ] && rm "${OUTPUT_FAT}"
+
+check_input
+create_partitions
+create_filesystem
+copy_files
+create_image
+
+echo "${OUTPUT} ready"
+
+# vim: set sw=4 ts=4 noet:
--
1.7.10
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ptxdist] [PATCH 3/3 v2] fontconfig: Fix Darwin build
2012-04-25 14:18 [ptxdist] [PATCH 1/3] Add host-parted Bernhard Walle
2012-04-25 14:18 ` [ptxdist] [PATCH 2/3] Allow creation of bootable SD card for OMAP CPUs Bernhard Walle
@ 2012-04-25 14:18 ` Bernhard Walle
1 sibling, 0 replies; 3+ messages in thread
From: Bernhard Walle @ 2012-04-25 14:18 UTC (permalink / raw)
To: ptxdist
Upstream solved it completely different
http://cgit.freedesktop.org/fontconfig/commit/?id=2a6b235ff6d2750171e8dff7cfdfe3bccb0f630e
now, so after updating fontconfig the patch will be obsolete. Applying
that patch is not possible, however, since I would need to re-create the
tarball.
However, I don't want to update fontconfig since it touches the whole
Xorg stack and I have no possibility to test that.
The first upstream version that contains the release is 2.9.0.
Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
v1 -> v2:
o Add comment about upstream status also in the patch header, not only
in the commit message.
o Also remove $(CFLAGS) since they contain cross cflags, not host cflags.
.../0001-Fix-build-on-Darwin.patch | 76 ++++++++++++++++++++
patches/fontconfig-2.6.0/autogen.sh | 1 +
patches/fontconfig-2.6.0/series | 4 ++
3 files changed, 81 insertions(+)
create mode 100644 patches/fontconfig-2.6.0/0001-Fix-build-on-Darwin.patch
create mode 120000 patches/fontconfig-2.6.0/autogen.sh
create mode 100644 patches/fontconfig-2.6.0/series
diff --git a/patches/fontconfig-2.6.0/0001-Fix-build-on-Darwin.patch b/patches/fontconfig-2.6.0/0001-Fix-build-on-Darwin.patch
new file mode 100644
index 0000000..fffb670
--- /dev/null
+++ b/patches/fontconfig-2.6.0/0001-Fix-build-on-Darwin.patch
@@ -0,0 +1,76 @@
+From beadde506169a71a89ba37e277c611a7b5b18154 Mon Sep 17 00:00:00 2001
+From: Bernhard Walle <bernhard@bwalle.de>
+Date: Sun, 8 Apr 2012 17:38:20 +0200
+Subject: [PATCH] Fix build on Darwin
+
+The problem is the -rpath-link that is used even on host CC but this
+option is not available on Mac OS.
+
+Upstream solved it completely different
+http://cgit.freedesktop.org/fontconfig/commit/?id=2a6b235ff6d2750171e8dff7cfdfe3bccb0f630e
+now, so after updating fontconfig the patch will be obsolete. Applying
+that patch is not possible, however, since it would be needed to
+re-create the tarball.
+
+The first upstream version that contains the release is 2.9.0.
+
+Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
+---
+ fc-arch/Makefile.am | 2 +-
+ fc-case/Makefile.am | 2 +-
+ fc-glyphname/Makefile.am | 2 +-
+ fc-lang/Makefile.am | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/fc-arch/Makefile.am b/fc-arch/Makefile.am
+index 7e1dd3e..ddc1fc1 100644
+--- a/fc-arch/Makefile.am
++++ b/fc-arch/Makefile.am
+@@ -24,7 +24,7 @@
+
+ CC = @CC_FOR_BUILD@
+ EXEEXT = @EXEEXT_FOR_BUILD@
+-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++LINK = $(CCLD) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@
+
+ INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
+
+diff --git a/fc-case/Makefile.am b/fc-case/Makefile.am
+index d4fa12d..1b63acf 100644
+--- a/fc-case/Makefile.am
++++ b/fc-case/Makefile.am
+@@ -24,7 +24,7 @@
+
+ CC = @CC_FOR_BUILD@
+ EXEEXT = @EXEEXT_FOR_BUILD@
+-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++LINK = $(CCLD) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@
+
+ INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
+
+diff --git a/fc-glyphname/Makefile.am b/fc-glyphname/Makefile.am
+index 412d663..ea55b98 100644
+--- a/fc-glyphname/Makefile.am
++++ b/fc-glyphname/Makefile.am
+@@ -24,7 +24,7 @@
+
+ CC = @CC_FOR_BUILD@
+ EXEEXT = @EXEEXT_FOR_BUILD@
+-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++LINK = $(CCLD) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@
+
+ INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
+
+diff --git a/fc-lang/Makefile.am b/fc-lang/Makefile.am
+index 60e4f31..44b103a 100644
+--- a/fc-lang/Makefile.am
++++ b/fc-lang/Makefile.am
+@@ -24,7 +24,7 @@
+
+ CC = @CC_FOR_BUILD@
+ EXEEXT = @EXEEXT_FOR_BUILD@
+-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
++LINK = $(CCLD) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@
+
+ INCLUDES=-I${top_srcdir}/src -I${top_srcdir} $(WARN_CFLAGS)
+
diff --git a/patches/fontconfig-2.6.0/autogen.sh b/patches/fontconfig-2.6.0/autogen.sh
new file mode 120000
index 0000000..9f8a4cb
--- /dev/null
+++ b/patches/fontconfig-2.6.0/autogen.sh
@@ -0,0 +1 @@
+../autogen.sh
\ No newline at end of file
diff --git a/patches/fontconfig-2.6.0/series b/patches/fontconfig-2.6.0/series
new file mode 100644
index 0000000..d9df7e0
--- /dev/null
+++ b/patches/fontconfig-2.6.0/series
@@ -0,0 +1,4 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-Fix-build-on-Darwin.patch
+# e4c948951d2fafee17a83f484c126a7e - git-ptx-patches magic
--
1.7.10
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 3+ messages in thread