From 9a12169bb24abec4fafc39f033407251a3025b93 Mon Sep 17 00:00:00 2001 From: Travis Glenn Hansen Date: Mon, 16 May 2011 11:43:53 -0600 Subject: [PATCH 1/3] adding darwrin-cross adding atv-bootloader updating scripts to be able to create a mach_kernel compatible kernel image adding udev rule with diskdev_cmds to auto fsck hfs/hfsplus partitions --- .../diskdev_cmds/udev.d/10-fsck-hfs.rules | 29 +++++++++++++++ .../toolchain/toolchains/darwin-cross/meta | 36 +++++++++++++++++++ .../toolchain/toolchains/darwin-cross/unpack | 27 ++++++++++++++ packages/tools/atv-bootloader/build | 30 ++++++++++++++++ packages/tools/atv-bootloader/meta | 36 +++++++++++++++++++ projects/ATV/options | 2 +- scripts/image_squashfs | 15 +++++++- 7 files changed, 173 insertions(+), 2 deletions(-) create mode 100644 packages/sysutils/diskdev_cmds/udev.d/10-fsck-hfs.rules create mode 100644 packages/toolchain/toolchains/darwin-cross/meta create mode 100755 packages/toolchain/toolchains/darwin-cross/unpack create mode 100755 packages/tools/atv-bootloader/build create mode 100644 packages/tools/atv-bootloader/meta diff --git a/packages/sysutils/diskdev_cmds/udev.d/10-fsck-hfs.rules b/packages/sysutils/diskdev_cmds/udev.d/10-fsck-hfs.rules new file mode 100644 index 0000000000..961dcc02da --- /dev/null +++ b/packages/sysutils/diskdev_cmds/udev.d/10-fsck-hfs.rules @@ -0,0 +1,29 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +#      Copyright (C) 2010-2011 Roman Weber (roman@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +SUBSYSTEM!="block", GOTO="end" +ACTION!="add", GOTO="end" + +ACTION=="add", IMPORT{program}="/sbin/blkid -o udev -p %N" +ACTION=="add", ENV{ID_FS_TYPE}=="hfs|hfsplus", RUN+="/usr/sbin/fsck.hfsplus -r -y /dev/%k" + +# exit +LABEL="end" diff --git a/packages/toolchain/toolchains/darwin-cross/meta b/packages/toolchain/toolchains/darwin-cross/meta new file mode 100644 index 0000000000..3c96175b4b --- /dev/null +++ b/packages/toolchain/toolchains/darwin-cross/meta @@ -0,0 +1,36 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="darwin-cross" +PKG_VERSION="" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="GPL" +PKG_SITE="http://gcc.gnu.org/" +PKG_URL="http://atv-bootloader.googlecode.com/files/$PKG_NAME.tar.gz" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS="" +PKG_PRIORITY="optional" +PKG_SECTION="toolchain/toolchains" +PKG_SHORTDESC="darwin-cross: darwin gcc etc" +PKG_LONGDESC="This package contains the GNU Compiler Collection to build for darwin systems" +PKG_IS_ADDON="no" + +PKG_AUTORECONF="no" diff --git a/packages/toolchain/toolchains/darwin-cross/unpack b/packages/toolchain/toolchains/darwin-cross/unpack new file mode 100755 index 0000000000..0f3856fa43 --- /dev/null +++ b/packages/toolchain/toolchains/darwin-cross/unpack @@ -0,0 +1,27 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + + +. config/options $1 + +tar -xzf "${PKG_BUILD}/darwin-cross.tar.gz" -C "${PKG_BUILD}" +mv "${PKG_BUILD}/darwin-cross/"* "${PKG_BUILD}" diff --git a/packages/tools/atv-bootloader/build b/packages/tools/atv-bootloader/build new file mode 100755 index 0000000000..522e4cef36 --- /dev/null +++ b/packages/tools/atv-bootloader/build @@ -0,0 +1,30 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. config/options $1 + +cd $PKG_BUILD + +TOOLS_PREFIX=$(readlink -f ../) + +sed -i -e "s:/opt:$TOOLS_PREFIX:" Makefile + diff --git a/packages/tools/atv-bootloader/meta b/packages/tools/atv-bootloader/meta new file mode 100644 index 0000000000..1c0b9d48b1 --- /dev/null +++ b/packages/tools/atv-bootloader/meta @@ -0,0 +1,36 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="atv-bootloader" +PKG_VERSION="r518" +PKG_REV="1" +PKG_ARCH="i386 x86_64" +PKG_LICENSE="GPL" +PKG_SITE="http://code.google.com/p/atv-bootloader/" +PKG_URL="http://travisghansen.openelec.tv/sources/$PKG_NAME-$PKG_VERSION.tar.gz" +PKG_DEPENDS="darwin-cross" +PKG_BUILD_DEPENDS="" +PKG_PRIORITY="optional" +PKG_SECTION="tools" +PKG_SHORTDESC="atv-bootloader: Tool to create a mach_kernel compaitible kernel image" +PKG_LONGDESC="atv-bootloader which uses principals from mach_linux_boot to boot a compiled-in Linux kernel" +PKG_IS_ADDON="no" + +PKG_AUTORECONF="no" diff --git a/projects/ATV/options b/projects/ATV/options index 0b52d8d9f6..2fa6fd7efc 100644 --- a/projects/ATV/options +++ b/projects/ATV/options @@ -78,7 +78,7 @@ PROJECT_CFLAGS="" # Bootloader to use (syslinux / u-boot) - BOOTLOADER="" + BOOTLOADER="atv-bootloader" # Configuration for u-boot UBOOT_CONFIG="" diff --git a/scripts/image_squashfs b/scripts/image_squashfs index abf205f707..03edaf095b 100755 --- a/scripts/image_squashfs +++ b/scripts/image_squashfs @@ -46,11 +46,24 @@ mkdir -p $TARGET_IMG KERNEL_ARCH="arm" fi - cp -PR $BUILD/linux-*/arch/$KERNEL_ARCH/boot/$KERNEL_IMAGE $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.kernel + if [ "$BOOTLOADER" = "atv-bootloader" ]; then + $SCRIPTS/build atv-bootloader + echo "creating mach_kernel compatible kernel image" + cp -PR $BUILD/linux-*/arch/$KERNEL_ARCH/boot/$KERNEL_IMAGE $BUILD/atv-bootloader* + cd $BUILD/atv-bootloader* + mv $KERNEL_IMAGE vmlinuz + make clean + make LDFLAGS="" + cd - + cp -PR $BUILD/atv-bootloader*/mach_kernel $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.kernel + else + cp -PR $BUILD/linux-*/arch/$KERNEL_ARCH/boot/$KERNEL_IMAGE $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.kernel + fi echo "rm -rf $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.system" >> $FAKEROOT_SCRIPT # echo "$ROOT/$TOOLCHAIN/bin/mksquashfs $BUILD/image/system $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.system -noappend -comp xz" >> $FAKEROOT_SCRIPT echo "$ROOT/$TOOLCHAIN/bin/mksquashfs $BUILD/image/system $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.system -noappend" >> $FAKEROOT_SCRIPT $ROOT/$TOOLCHAIN/bin/fakeroot -- $FAKEROOT_SCRIPT chmod 0644 $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.system + chmod 0644 $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.kernel rm -rf $FAKEROOT_SCRIPT From a8831734066ad9da5f002da32a9e281d3e00bcd4 Mon Sep 17 00:00:00 2001 From: Travis Glenn Hansen Date: Tue, 17 May 2011 01:27:45 -0600 Subject: [PATCH 2/3] reworking atv-bootloader build script to create a mach_kernel directly --- packages/tools/atv-bootloader/build | 11 ++++++++++- packages/tools/atv-bootloader/meta | 4 ++-- scripts/image_squashfs | 12 ++---------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/packages/tools/atv-bootloader/build b/packages/tools/atv-bootloader/build index 522e4cef36..a0e651676f 100755 --- a/packages/tools/atv-bootloader/build +++ b/packages/tools/atv-bootloader/build @@ -22,9 +22,18 @@ . config/options $1 +get_version + cd $PKG_BUILD -TOOLS_PREFIX=$(readlink -f ../) +TOOLS_PREFIX="$ROOT/$BUILD" sed -i -e "s:/opt:$TOOLS_PREFIX:" Makefile +cp -PR $ROOT/$BUILD/linux-*/arch/x86/boot/bzImage vmlinuz + +make clean +make LDFLAGS="" + +cp -PR mach_kernel $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.mach_kernel +chmod 0644 $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.mach_kernel diff --git a/packages/tools/atv-bootloader/meta b/packages/tools/atv-bootloader/meta index 1c0b9d48b1..62846e9fb7 100644 --- a/packages/tools/atv-bootloader/meta +++ b/packages/tools/atv-bootloader/meta @@ -25,8 +25,8 @@ PKG_ARCH="i386 x86_64" PKG_LICENSE="GPL" PKG_SITE="http://code.google.com/p/atv-bootloader/" PKG_URL="http://travisghansen.openelec.tv/sources/$PKG_NAME-$PKG_VERSION.tar.gz" -PKG_DEPENDS="darwin-cross" -PKG_BUILD_DEPENDS="" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS="darwin-cross linux" PKG_PRIORITY="optional" PKG_SECTION="tools" PKG_SHORTDESC="atv-bootloader: Tool to create a mach_kernel compaitible kernel image" diff --git a/scripts/image_squashfs b/scripts/image_squashfs index 03edaf095b..8488e0f0cd 100755 --- a/scripts/image_squashfs +++ b/scripts/image_squashfs @@ -46,18 +46,10 @@ mkdir -p $TARGET_IMG KERNEL_ARCH="arm" fi + cp -PR $BUILD/linux-*/arch/$KERNEL_ARCH/boot/$KERNEL_IMAGE $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.kernel + if [ "$BOOTLOADER" = "atv-bootloader" ]; then $SCRIPTS/build atv-bootloader - echo "creating mach_kernel compatible kernel image" - cp -PR $BUILD/linux-*/arch/$KERNEL_ARCH/boot/$KERNEL_IMAGE $BUILD/atv-bootloader* - cd $BUILD/atv-bootloader* - mv $KERNEL_IMAGE vmlinuz - make clean - make LDFLAGS="" - cd - - cp -PR $BUILD/atv-bootloader*/mach_kernel $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.kernel - else - cp -PR $BUILD/linux-*/arch/$KERNEL_ARCH/boot/$KERNEL_IMAGE $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.kernel fi echo "rm -rf $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.system" >> $FAKEROOT_SCRIPT From 70df6f6d29b1f506f10bba434bfbabf14b0ad98d Mon Sep 17 00:00:00 2001 From: Travis Glenn Hansen Date: Wed, 18 May 2011 21:25:55 -0600 Subject: [PATCH 3/3] adding real blkid to initramfs supporting single-boot ATV update process --- packages/initramfs/meta | 2 +- .../sysutils/busybox-initramfs/scripts/init | 18 ++++++++++ .../sysutils/util-linux-initramfs/install | 28 +++++++++++++++ .../sysutils/util-linux-initramfs/meta | 36 +++++++++++++++++++ 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100755 packages/initramfs/sysutils/util-linux-initramfs/install create mode 100644 packages/initramfs/sysutils/util-linux-initramfs/meta diff --git a/packages/initramfs/meta b/packages/initramfs/meta index 6bbab40a01..a7cd1ce35f 100644 --- a/packages/initramfs/meta +++ b/packages/initramfs/meta @@ -36,5 +36,5 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="no" if [ "$HFSTOOLS" = "yes" ]; then - PKG_DEPENDS="$PKG_DEPENDS diskdev_cmds-initramfs" + PKG_DEPENDS="$PKG_DEPENDS diskdev_cmds-initramfs util-linux-initramfs" fi diff --git a/packages/initramfs/sysutils/busybox-initramfs/scripts/init b/packages/initramfs/sysutils/busybox-initramfs/scripts/init index c6e8c4eede..e11f839414 100755 --- a/packages/initramfs/sysutils/busybox-initramfs/scripts/init +++ b/packages/initramfs/sysutils/busybox-initramfs/scripts/init @@ -115,8 +115,26 @@ REBOOT="0" fi } + hfsdiskprep() { + for DEV in `/bin/busybox ls /dev/sd*`; do + FS_TYPE=$(/sbin/blkid -o value -s TYPE $DEV) + if [ "$FS_TYPE" = "hfs" -o "$FS_TYPE" = "hfsplus" ]; then + /sbin/fsck_hfs -r -y $DEV > /dev/null 2>&1 + fi + done + } + +# deal with hfs partitions + if [ -x /sbin/fsck_hfs ]; then + hfsdiskprep + fi + mount_part "$boot" "/flash" "ro,noatime" + if [ -f "/flash/atv_single_boot" ]; then + IMAGE_KERNEL="MACH_KERNEL" + fi + show_splash if [ -n "$disk" ]; then diff --git a/packages/initramfs/sysutils/util-linux-initramfs/install b/packages/initramfs/sysutils/util-linux-initramfs/install new file mode 100755 index 0000000000..67aeeddaa2 --- /dev/null +++ b/packages/initramfs/sysutils/util-linux-initramfs/install @@ -0,0 +1,28 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. config/options $1 + +UTIL_LINUX_DIR="$BUILD/util-linux-*" + +mkdir -p $INSTALL/sbin + cp $UTIL_LINUX_DIR/misc-utils/blkid $INSTALL/sbin diff --git a/packages/initramfs/sysutils/util-linux-initramfs/meta b/packages/initramfs/sysutils/util-linux-initramfs/meta new file mode 100644 index 0000000000..6b38110560 --- /dev/null +++ b/packages/initramfs/sysutils/util-linux-initramfs/meta @@ -0,0 +1,36 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC.tv; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +PKG_NAME="util-linux-initramfs" +PKG_VERSION="" +PKG_REV="1" +PKG_ARCH="any" +PKG_LICENSE="APSL" +PKG_SITE="http://userweb.kernel.org/~kzak/util-linux-ng/" +PKG_URL="" +PKG_DEPENDS="" +PKG_BUILD_DEPENDS="toolchain util-linux" +PKG_PRIORITY="optional" +PKG_SECTION="initramfs/system" +PKG_SHORTDESC="util-linux: Miscellaneous system utilities for Linux" +PKG_LONGDESC="The util-linux package contains a large variety of low-level system utilities that are necessary for a Linux system to function. Among many features, Util-linux contains the fdisk configuration tool and the login program." +PKG_IS_ADDON="no" + +PKG_AUTORECONF="no"