[oe-commits] Simon 'Morphis' Busch : preboot: new recipe; a dual boot solution for the palm pre (WIP)

git version control git at git.openembedded.org
Wed Jan 20 19:17:42 UTC 2010


Module: openembedded.git
Branch: shr/unstable
Commit: c87ea56a9e59dd4b3ddf67d900f4e14c1168bcd0
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=c87ea56a9e59dd4b3ddf67d900f4e14c1168bcd0

Author: Simon 'Morphis' Busch <morphis at gravedo.de>
Date:   Wed Jan 20 18:14:42 2010 +0100

preboot: new recipe; a dual boot solution for the palm pre (WIP)

---

 recipes/preboot/files/etc/init.d/usbnet         |    9 +++
 recipes/preboot/files/etc/miniboot.sh           |   43 ++++++++++++++
 recipes/preboot/initramfs-preboot-image.bb      |   69 +++++++++++++++++++++++
 recipes/preboot/linux-preboot-palmpre_2.6.24.bb |   24 ++++++++
 recipes/preboot/linux-preboot.inc               |   54 ++++++++++++++++++
 5 files changed, 199 insertions(+), 0 deletions(-)

diff --git a/recipes/preboot/files/etc/init.d/usbnet b/recipes/preboot/files/etc/init.d/usbnet
new file mode 100644
index 0000000..e6c7f4e
--- /dev/null
+++ b/recipes/preboot/files/etc/init.d/usbnet
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# usb gadget configuration:
+# there already different configurations on the palm pre defined, we choose nr 5
+# cause it provides the usbnet, novacom and storage gadget
+if [ -e /sys/class/usb_gadget/config_num ]; then
+        echo 5 > /sys/class/usb_gadget/config_num
+fi
+
diff --git a/recipes/preboot/files/etc/miniboot.sh b/recipes/preboot/files/etc/miniboot.sh
new file mode 100644
index 0000000..1997ff8
--- /dev/null
+++ b/recipes/preboot/files/etc/miniboot.sh
@@ -0,0 +1,43 @@
+#!/bin/sh                                
+
+# Mount proc
+mount -t proc proc /proc -o rw,noexec,nosuid,nodev
+# Mount sys
+mount -t sysfs sys /sys -o rw,noexec,nosuid,nodev
+
+# Mount root rw
+mount / -o remount,rw
+
+# Prep modules
+depmod -A
+
+# Populate /dev
+/etc/init.d/udev start
+
+# Mount everything
+# mount -a
+
+# Setup a proper /tmp using tmpfs
+cat /proc/mounts | grep -q "\s/tmp\s"
+[ "x$?" != "x0" ] && mount -t tmpfs tmpfs /tmp
+
+cat /proc/mounts | grep -q "\s/dev/pts\s"
+[ "x$?" != "x0" ] && mount -t devpts devpts /dev/pts
+
+# Set the hostname
+hostname -F /etc/hostname
+
+# USB gadget configuration
+if [ -e /sys/class/usb_gadget/config_num ]; then
+	echo 5 > /sys/class/usb_gadget/config_num
+fi
+
+# USB network configuration
+ifup -f usb0
+ifconfig usb0 192.168.0.202
+
+# Dropbear ssh service
+/etc/init.d/dropbear start
+
+# Spin relaunching login
+while true; do getty 115200 console; done
diff --git a/recipes/preboot/initramfs-preboot-image.bb b/recipes/preboot/initramfs-preboot-image.bb
new file mode 100644
index 0000000..0675916
--- /dev/null
+++ b/recipes/preboot/initramfs-preboot-image.bb
@@ -0,0 +1,69 @@
+#initramfs image which mounts the rootfilesystem and kexecs a kernel from there
+PR = "r1"
+
+ONLINE_PACKAGE_MANAGEMENT = "none"
+IMAGE_FSTYPES = "cpio.gz"
+
+export IMAGE_BASENAME = "initramfs-preboot-image"
+
+IMAGE_PREPROCESS_COMMAND = "create_etc_timestamp"
+
+# avoid circular dependencies
+EXTRA_IMAGEDEPENDS = ""
+
+IMAGE_INSTALL = " \
+	task-boot \
+	util-linux-ng-mount util-linux-ng-umount \
+	dropbear \
+	fontconfig \
+	ttf-freefonts \
+	eina \
+	evas \
+	edje \
+	efreet \
+	eet \
+	edbus \
+	elementary \
+	elementary-themes \
+	elementary-tests \
+	fbset \
+	fbset-init \
+    msmcommd \
+#	lvm2 \
+#	preboot \
+	"
+
+IMAGE_LINGUAS = ""
+
+inherit image
+
+preboot_palmpre_rootfs_postprocess() {
+	# copy all our files to the rootfs
+	dirs=`find ${FILESDIR} -type d -printf "%P\n" | grep -v "^.$" | grep -v ".git"`
+	for dir in $dirs; do
+		mkdir -p ${IMAGE_ROOTFS}/$dir
+	done
+	files=`find ${FILESDIR} -type f -printf "%P\n" | grep -v ".git"`
+	for file in $files; do
+		cp -f ${FILESDIR}/$file ${IMAGE_ROOTFS}/$file
+	done
+
+	curdir=$PWD
+	cd ${IMAGE_ROOTFS}
+
+	# install our usbnet initscript
+	chmod +x etc/init.d/usbnet
+#	ln -sf ../init.d/usbnet ${IMAGE_ROOTFS}/etc/rcS.d/S15usbnet
+
+	# miniboot sequence (just for debugging)
+	rm ${IMAGE_ROOTFS}/sbin/init
+	chmod +x ${IMAGE_ROOTFS}/etc/miniboot.sh 
+	ln -sf /etc/miniboot.sh ${IMAGE_ROOTFS}/init
+	ln -sf ../etc/miniboot.sh ${IMAGE_ROOTFS}/sbin/init
+
+	cd $curdir
+}
+
+ROOTFS_POSTPROCESS_COMMAND_palmpre += " preboot_palmpre_rootfs_postprocess"
+
+
diff --git a/recipes/preboot/linux-preboot-palmpre_2.6.24.bb b/recipes/preboot/linux-preboot-palmpre_2.6.24.bb
new file mode 100644
index 0000000..e2d278c
--- /dev/null
+++ b/recipes/preboot/linux-preboot-palmpre_2.6.24.bb
@@ -0,0 +1,24 @@
+require linux-preboot.inc
+
+DEFAULT_PREFERENCE = "-1"
+DEFAULT_PREFERENCE_palmpre = "-1"
+
+# Hacks should clearly named and at the bottom
+SRC_URI += "${KERNELORG_MIRROR}/pub/linux/kernel/v2.6/linux-2.6.24.tar.bz2 \
+           "
+
+SRC_URI_append_palmpre = "\
+http://palm.cdnetworks.net/opensource/1.3.1/linuxkernel-2.6.24-patch.gz;patch=1 \
+"
+S = "${WORKDIR}/linux-2.6.24"
+
+# We try to build the identical kernel as Palms here, use their defconfig.
+do_configure_prepend() {
+        install -m 0644 ${S}/arch/arm/configs/omap_sirloin_3430_defconfig ${WORKDIR}/defconfig
+}
+
+# linux.inc overrides LOCAVERSION but we like to stay with the one used originally
+do_compile_prepend() {
+	sed -i -e '/CONFIG_LOCALVERSION=/d' ${S}/.config
+	echo 'CONFIG_LOCALVERSION="-joplin-3430"' >>${S}/.config
+}
diff --git a/recipes/preboot/linux-preboot.inc b/recipes/preboot/linux-preboot.inc
new file mode 100644
index 0000000..4f99b71
--- /dev/null
+++ b/recipes/preboot/linux-preboot.inc
@@ -0,0 +1,54 @@
+# We set PR here, since a change in the kexecboot recipe will need to get picked up by *all* the kernels:
+PR = "r15"
+
+SRC_URI = "file://defconfig"
+
+LOGO_SIZE = '${@base_conditional("GUI_MACHINE_CLASS", "bigscreen", "vga", "qvga", d)}'
+
+require ../linux/linux.inc
+
+DONT_CHECK_KERNELSIZE = ""
+INITRAMFS_IMAGE = "initramfs-preboot-image"
+
+# here we set master console on serial
+CMDLINE = "console=tty1 console=ttyS0,115200n8"
+
+PACKAGES = ""
+PROVIDES = ""
+
+KERNEL_IMAGE_BASE_NAME = "${KERNEL_IMAGETYPE}-preboot-${PV}-${PR}-${MACHINE}"
+KERNEL_IMAGE_SYMLINK_NAME = "${KERNEL_IMAGETYPE}-preboot-${MACHINE}"
+
+do_configure[depends] += "${INITRAMFS_IMAGE}:do_rootfs"
+
+do_configure_append() {
+sed -i -e /CONFIG_BLK_DEV_INITRD/d \
+       -e /CONFIG_KEXEC/d \
+       -e /CONFIG_INITRAMFS_SOURCE/d \
+       -e /=m/d \
+       -e /CONFIG_MODULES/d \
+       -e /CONFIG_DEBUG_ERRORS/d \
+       -e /CONFIG_DEBUG_BUGVERBOSE/d \
+       -e /CONFIG_DEBUG_KERNEL/d \
+       ${S}/.config
+
+# Remove last tag appended by linux.inc (output messes screen)
+sed -i -e /CONFIG_CMDLINE/s/quiet/loglevel=3/1 ${S}/.config
+sed -i -e /CONFIG_CMDLINE/s/debug/loglevel=3/1 ${S}/.config
+
+echo 'CONFIG_BLK_DEV_INITRD=y
+CONFIG_KEXEC=y
+CONFIG_INITRAMFS_SOURCE="initramfs.cpio.gz"
+CONFIG_MODULES=n' >> ${S}/.config
+
+        yes '' | oe_runmake oldconfig
+}
+
+do_stage() {
+}
+
+do_install() {
+}
+
+python do_package() {
+}





More information about the Openembedded-commits mailing list