diff --git a/Makefile b/Makefile index 10ab9b0c07..44e28ba802 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,12 @@ BUILD_DIRS="build.*" -all: squashfs +all: system system: ./scripts/image release: - ./scripts/image_release - -squashfs: - ./scripts/image_squashfs - -qemu: - ./scripts/image_qemu - -vmware: - ./scripts/image_vmware - -addons: - ./scripts/image_addons + ./scripts/image release clean: rm -rf $(BUILD_DIRS) diff --git a/config/functions b/config/functions index de6fbec8cf..8bf9a821c8 100644 --- a/config/functions +++ b/config/functions @@ -114,16 +114,6 @@ add_group() { fi } -get_version() { - if [ "$OPENELEC_VERSION" = devel -o "$OPENELEC_VERSION" = debug ]; then - GIT_BUILD=`git log --pretty=format:'' | wc -l` - GIT_HASH=`git log -n1 --format=%H` - OPENELEC_VERSION=$OPENELEC_VERSION-$BUILD_DATE-r$GIT_BUILD - fi - - TARGET_VERSION="$PROJECT.$TARGET_ARCH-$OPENELEC_VERSION" -} - do_autoreconf() { if [ -e $ROOT/$TOOLCHAIN/bin/autoreconf ] && [ -e $ROOT/$TOOLCHAIN/bin/autoconf ] && diff --git a/config/path b/config/path index 36d9f7fb2e..f60f280fa5 100644 --- a/config/path +++ b/config/path @@ -114,8 +114,6 @@ if [ -z "$PATH" -o "$PATH" = "${PATH#$ROOT/$TOOLCHAIN/bin:}" ]; then fi VERSION_SUFFIX=$TARGET_ARCH -BUILD_DATE=`date +%Y%m%d%H%M%S` - . config/functions setup_toolchain target diff --git a/scripts/image b/scripts/image index 7602734010..6d9152f183 100755 --- a/scripts/image +++ b/scripts/image @@ -24,19 +24,33 @@ $SCRIPTS/checkdeps build $SCRIPTS/build toolchain +$SCRIPTS/build squashfs +$SCRIPTS/build fakeroot export INSTALL=$BUILD/image/system -get_version +BUILD_DATE=`date +%Y%m%d%H%M%S` -rm -rf $INSTALL -rm -rf $STAMPS_INSTALL +if [ "$OPENELEC_VERSION" = devel -o "$OPENELEC_VERSION" = debug ]; then + GIT_BUILD=`git log --pretty=format:'' | wc -l` + GIT_HASH=`git log -n1 --format=%H` + OPENELEC_VERSION=$OPENELEC_VERSION-$BUILD_DATE-r$GIT_BUILD +fi -mkdir -p $INSTALL +TARGET_VERSION="$PROJECT.$TARGET_ARCH-$OPENELEC_VERSION" +IMAGE_NAME="$DISTRONAME-$TARGET_VERSION" # setup fakeroot + rm -rf $FAKEROOT_SCRIPT # remove $FAKEROOT_SCRIPT if it exist + touch $FAKEROOT_SCRIPT # create an empty $FAKEROOT_SCRIPT + chmod +x $FAKEROOT_SCRIPT # make $FAKEROOT_SCRIPT executable echo "chown -R 0:0 $INSTALL" >> $FAKEROOT_SCRIPT +# clean old install dirs + rm -rf $INSTALL + rm -rf $STAMPS_INSTALL + mkdir -p $INSTALL + # create baselayout mkdir -p $INSTALL/bin mkdir -p $INSTALL/etc @@ -50,7 +64,6 @@ mkdir -p $INSTALL mkdir -p $INSTALL/var mkdir -p $INSTALL/flash mkdir -p $INSTALL/storage - ln -sf /var $INSTALL/usr/var ln -sf /var/tmp $INSTALL/tmp ln -sf /var/media $INSTALL/media @@ -140,3 +153,89 @@ mkdir -p $INSTALL for MOD in `find $INSTALL/lib/modules/ -name *.ko`; do $STRIP --strip-debug $MOD done + +# make target dir + mkdir -p $TARGET_IMG + rm -rf $TARGET_IMG/$IMAGE_NAME.kernel + rm -rf $TARGET_IMG/$IMAGE_NAME.mach_kernel + +# copy kernel to target dir + if [ "$BOOTLOADER" = "u-boot" ]; then + KERNEL_IMAGE="uImage" + else + KERNEL_IMAGE="bzImage" + fi + + if [ "$TARGET_ARCH" = i386 -o "$TARGET_ARCH" = x86_64 ]; then + KERNEL_ARCH="x86" + elif [ "$TARGET_ARCH" = arm ]; then + KERNEL_ARCH="arm" + fi + + cp -PR $BUILD/linux-*/arch/$KERNEL_ARCH/boot/$KERNEL_IMAGE $TARGET_IMG/$IMAGE_NAME.kernel + + if [ "$BOOTLOADER" = "atv-bootloader" ]; then + cp -PR $BUILD/atv-bootloader-*/mach_kernel $TARGET_IMG/$IMAGE_NAME.mach_kernel + chmod 0644 $TARGET_IMG/$IMAGE_NAME.mach_kernel + fi + +# create squashfs file + echo "rm -rf $TARGET_IMG/$IMAGE_NAME.system" >> $FAKEROOT_SCRIPT +# echo "$ROOT/$TOOLCHAIN/bin/mksquashfs $BUILD/image/system $TARGET_IMG/$IMAGE_NAME.system -noappend -comp xz" >> $FAKEROOT_SCRIPT + echo "$ROOT/$TOOLCHAIN/bin/mksquashfs $BUILD/image/system $TARGET_IMG/$IMAGE_NAME.system -noappend" >> $FAKEROOT_SCRIPT + +# run fakeroot + $ROOT/$TOOLCHAIN/bin/fakeroot -- $FAKEROOT_SCRIPT + rm -rf $FAKEROOT_SCRIPT + +# set permissions + chmod 0644 $TARGET_IMG/$IMAGE_NAME.system + chmod 0644 $TARGET_IMG/$IMAGE_NAME.kernel + + if [ $1 = "release" ]; then + + RELEASE_DIR="target/$IMAGE_NAME" + + # cleanup + rm -rf $RELEASE_DIR + + # create release dir + mkdir -p $RELEASE_DIR + cp $ROOT/README $RELEASE_DIR + cp $ROOT/CHANGELOG $RELEASE_DIR +# cp -R $CONFIG/image/* $RELEASE_DIR + cp -R $CONFIG/release/* $RELEASE_DIR + echo "$TARGET_VERSION" > $RELEASE_DIR/RELEASE + + mkdir -p $RELEASE_DIR/licenses + cp $ROOT/licenses/* $RELEASE_DIR/licenses + + mkdir -p $RELEASE_DIR/target + cp $TARGET_IMG/$IMAGE_NAME.system $RELEASE_DIR/target/SYSTEM + cp $TARGET_IMG/$IMAGE_NAME.kernel $RELEASE_DIR/target/KERNEL + + if [ -f $TARGET_IMG/$IMAGE_NAME.mach_kernel ]; then + cp $TARGET_IMG/$IMAGE_NAME.mach_kernel $RELEASE_DIR/target/MACH_KERNEL + fi + + # create md5sum's + ( cd $RELEASE_DIR; + md5sum -t target/SYSTEM > target/SYSTEM.md5; + md5sum -t target/KERNEL > target/KERNEL.md5; + if [ -f target/MACH_KERNEL ]; then + md5sum -t target/MACH_KERNEL > target/MACH_KERNEL.md5; + fi + ) + + # create target directory + mkdir -p $TARGET_IMG + + # remove an previous created release tarball + rm -rf $TARGET_IMG/$IMAGE_NAME.tar.bz2 + + # create release tarball + tar cjf $TARGET_IMG/$IMAGE_NAME.tar.bz2 -C target $IMAGE_NAME + + # cleanup release dir + rm -rf $RELEASE_DIR + fi diff --git a/scripts/image_release b/scripts/image_release deleted file mode 100755 index 9b0accaa8b..0000000000 --- a/scripts/image_release +++ /dev/null @@ -1,72 +0,0 @@ -#!/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 - -$SCRIPTS/image_squashfs - -get_version - -RELEASE_DIR="target/$DISTRONAME-$TARGET_VERSION" - -# cleanup - rm -rf $RELEASE_DIR - -# create release dir - mkdir -p $RELEASE_DIR - cp $ROOT/README $RELEASE_DIR - cp $ROOT/CHANGELOG $RELEASE_DIR - # cp -R $CONFIG/image/* $RELEASE_DIR - cp -R $CONFIG/release/* $RELEASE_DIR - echo "$TARGET_VERSION" > $RELEASE_DIR/RELEASE - - mkdir -p $RELEASE_DIR/licenses - cp $ROOT/licenses/* $RELEASE_DIR/licenses - - mkdir -p $RELEASE_DIR/target - cp $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.system $RELEASE_DIR/target/SYSTEM - cp $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.kernel $RELEASE_DIR/target/KERNEL - - if [ -f $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.mach_kernel ]; then - cp $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.mach_kernel $RELEASE_DIR/target/MACH_KERNEL - fi - -# create md5sum's - ( cd $RELEASE_DIR; - md5sum -t target/SYSTEM > target/SYSTEM.md5; - md5sum -t target/KERNEL > target/KERNEL.md5; - if [ -f target/MACH_KERNEL ]; then - md5sum -t target/MACH_KERNEL > target/MACH_KERNEL.md5; - fi - ) - -# create target directory - mkdir -p $TARGET_IMG - -# remove an previous created release tarball - rm -rf $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.tar.bz2 - -# create release tarball - tar cjf $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.tar.bz2 -C target $DISTRONAME-$TARGET_VERSION - -# cleanup release dir - rm -rf $RELEASE_DIR diff --git a/scripts/image_squashfs b/scripts/image_squashfs deleted file mode 100755 index 3a7b2c7e28..0000000000 --- a/scripts/image_squashfs +++ /dev/null @@ -1,64 +0,0 @@ -#!/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 - -rm -rf $FAKEROOT_SCRIPT # remove $FAKEROOT_SCRIPT if it exist -touch $FAKEROOT_SCRIPT # create an empty $FAKEROOT_SCRIPT -chmod +x $FAKEROOT_SCRIPT # make $FAKEROOT_SCRIPT executable - -$SCRIPTS/image -$SCRIPTS/build squashfs -$SCRIPTS/build fakeroot - -get_version - -mkdir -p $TARGET_IMG - rm -rf $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.kernel - rm -rf $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.mach_kernel - - if [ "$BOOTLOADER" = "u-boot" ]; then - KERNEL_IMAGE="uImage" - else - KERNEL_IMAGE="bzImage" - fi - - if [ "$TARGET_ARCH" = i386 -o "$TARGET_ARCH" = x86_64 ]; then - KERNEL_ARCH="x86" - elif [ "$TARGET_ARCH" = arm ]; then - 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 - cp -PR $BUILD/atv-bootloader-*/mach_kernel $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.mach_kernel - chmod 0644 $TARGET_IMG/$DISTRONAME-$TARGET_VERSION.mach_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