[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lost] [Patch] [4/4] Service-Manager - Buildsystemänderungen



Am Donnerstag, 26. Juni 2008 23:00:03 schrieb Antoine Kaufmann:
> Noch ein Versuch, diesmal mit Anhang ;-)

> Index: trunk/buildmk.sh
> ===================================================================
> --- trunk.orig/buildmk.sh
> +++ trunk/buildmk.sh
> @@ -37,7 +37,8 @@ shopt -s extglob
>  
>  INCLUDES=`echo $1 | sed -e 's#-I \?\([^ ]\+\)#-I ../\1#g'`
>  NASMINCLUDES=`echo $1 | sed -e 's#-I \?\([^ ]\+\)#-I ../\1/#g'`
> -LIBDIRS=`echo $2 | sed -e 's#lib/#../lib/#g'`
> +LIBDIRS="$2"
> +
>  
>  if [ -z $LOST_BUILDMK_ROOT ]; then
>    export LOST_BUILDMK_ROOT="`pwd`"
> @@ -59,20 +60,21 @@ FPCINCLUDES=`echo $INCLUDES | sed -e 's#
>  
>  if [ -d lib ]; then
>      if [ -f lib/prt0.asm ]; then
> -        LIBDIRS="lib/prt0.o $LIBDIRS"
> +        LIBDIRS="`pwd`/lib/prt0.o $LIBDIRS"
>      fi
> -    LIBDIRS="lib/library.a $LIBDIRS"
> +    LIBDIRS="`pwd`/lib/library.a $LIBDIRS"
>  fi
>  
>  CC_FLAGS=
> +CC_FLAGS_APPEND=
>  if [ -f Makefile.conf ]; then
>      source Makefile.conf
>  fi
>  
>  cat <<EOF > Makefile
> -CC=$LOST_TOOLS_GCC $CC_FLAGS $INCLUDES
> +CC=$LOST_TOOLS_GCC $CC_FLAGS $INCLUDES $CC_FLAGS_APPEND
>  CPP=$LOST_TOOLS_GPP $INCLUDES
> -PPC=fpc -n -Cn -CX -Tlost $FPCINCLUDES -Fu../lib/units -Fu../units
> +PPC=$LOST_TOOLS_PPC -n -Cn -CX -Tlost $FPCINCLUDES -Fu../lib/units
> -Fu../units 
>  ASM_ELF=nasm -felf -O99 $NASMINCLUDES
>  ASM_BIN=nasm -fbin -O99
> @@ -215,7 +217,7 @@ clean:
>         rm -f *.o *.a *.mod
>         for file in *; do if [ -f "\$\$file/Makefile" -a ! -f
> "\$\$file/.nobuild" ]; then make -sC "\$\$file" clean; rm
> "\$\$file/Makefile"; fi done   
> -.SILENT: all makefiles subdirs obj clean image
> +.SILENT: all makefiles subdirs obj clean clean_root updateroot
> image-floppy image-hd test-qemu test-qemu-hd EOF
>  
>  if [ "$LOST_BUILDMK_ROOT" == "`pwd`" ]; then
> @@ -223,59 +225,27 @@ cat <<EOF >> Makefile
>  clean: clean_root
>  
>  clean_root:
> -       @rm -f build/lost.img
> -       @rm -f build/output/apps/* build/output/modules/*
> build/output/kernel/* build/output/gz/*/* +       rm -rf build/images/*
> build/root/*
> +       rm -f build/output/apps/* build/output/modules/*
> build/output/kernel/* build/output/gz/*/* +       rm -f qemu.log
>  
> -internal_image:
> -       if ! [ -f build/lost.img ]; then \
> -        PATH=\$\$PATH:/sbin:/usr/sbin:/usr/local/sbin ;\
> -               dd if=/dev/zero of=build/lost.img bs=1024 count=1440 ;\
> -               mkfs.msdos build/lost.img ;\
> -               mmd -i build/lost.img ::/boot ;\
> -               mmd -i build/lost.img ::/boot/grub ;\
> -               mmd -i build/lost.img ::/modules ;\
> -               mmd -i build/lost.img ::/apps ;\
> -               mcopy -i build/lost.img /boot/grub/stage? ::/boot/grub ;\
> -               mcopy -i build/lost.img build/default.cfg
> ::/boot/grub/menu.lst ;\ -               echo device '(fd0)' build/lost.img
> > build/grub.txt ;\ -               echo root '(fd0)' >> build/grub.txt ;\
> -               echo setup '(fd0)' >> build/grub.txt ;\
> -               grub --batch < build/grub.txt ;\
> -               rm build/grub.txt ;\
> -       fi
> -       
> -       for i in build/output/kernel/*; do \
> -               gzip -c \$\$i > build/output/gz/kernel/\`basename \$\$i\`
> ;\ -       done
> -       
> -       for i in build/output/modules/*; do \
> -               gzip -c \$\$i > build/output/gz/modules/\`basename \$\$i\`
> ;\ -       done
> -
> -       for i in build/output/apps/*; do \
> -               gzip -c \$\$i > build/output/gz/apps/\`basename \$\$i\` ;\
> -       done
> -       
> -       
> -       mcopy -D o -i build/lost.img build/default.cfg
> ::/boot/grub/menu.lst -
> -       mcopy -D o -i build/lost.img build/output/gz/kernel/* ::/boot/
> -       mcopy -D o -i build/lost.img build/output/gz/modules/* ::/modules/
> -       mcopy -D o -i build/lost.img build/output/gz/apps/* ::/apps/
> -       mcopy -D o -i build/lost.img build/root/* ::/
> -
> -image:
> -       make --no-print-directory -s all
> -       make --no-print-directory -s internal_image
> +updateroot: subdirs
> +       build/scripts/updateroot
>  
> -simage:
> -       make --no-print-directory -s subdirs
> -       make --no-print-directory -s internal_image
> +image-floppy: updateroot
> +       build/scripts/image_floppy
> +
> +image-hd: updateroot
> +       build/scripts/image_hd
>         
> -test-qemu: image
> -       qemu -serial stdio -fda build/lost.img -boot a
> +test-qemu: image-floppy
> +       qemu -serial stdio -fda build/images/floppy.img -boot a -net user
> -net nic,model=rtl8139 | tee qemu-serial.log +
> +test-qemu-hd: image-hd
> +       rm -f qemu.log
> +       qemu -serial stdio -hda build/images/hd.img -net user -net
> nic,model=rtl8139 | tee qemu.log 

qemu.log ist auch bei Festplatten ein schlechter Name.

> Index: trunk/build/scripts/image_floppy
> ===================================================================
> --- /dev/null
> +++ trunk/build/scripts/image_floppy
> @@ -0,0 +1,83 @@
> +#!/bin/bash
> +
> +# Copyright (c) 2008 The LOST Project. All rights reserved.
> +#
> +# This code is derived from software contributed to the LOST Project
> +# by Antoine Kaufmann.
> +#
> +# Redistribution and use in source and binary forms, with or without
> +# modification, are permitted provided that the following conditions
> +# are met:
> +# 1. Redistributions of source code must retain the above copyright
> +#    notice, this list of conditions and the following disclaimer.
> +# 2. Redistributions in binary form must reproduce the above copyright
> +#    notice, this list of conditions and the following disclaimer in the
> +#    documentation and/or other materials provided with the distribution.
> +# 3. All advertising materials mentioning features or use of this software
> +#    must display the following acknowledgement:
> +#     This product includes software developed by the LOST Project
> +#     and its contributors.
> +# 4. Neither the name of the LOST Project nor the names of its
> +#    contributors may be used to endorse or promote products derived
> +#    from this software without specific prior written permission.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> PARTICULAR +# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
> HOLDERS OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
> TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
> PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
> LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +
> +ROOT=build/root
> +ROOT_COMMON=build/root-common
> +ROOT_FLOPPY=build/root-floppy
> +source build/config/image_floppy.sh
> +
> +export PATH="/sbin:/usr/sbin:$PATH"
> +export MTOOLSRC=lostmtools.conf
> +
> +# Konfigurationsdatei fuer mtools generieren
> +cat << EOF > $MTOOLSRC
> +drive l:
> +    file="$IMAGE_PATH" cylinders=80 heads=2 sectors=18 filter
> +EOF
> +
> +# Wenn das Image neu erstellt werden muss, kommen noch ein paar schritte
> mehr +# dazu.
> +NEW=0
> +if ! [ -f $IMAGE_PATH ]; then
> +    # Leeres Image erstellen und formatieren
> +    dd if=/dev/zero of=$IMAGE_PATH bs=1024 count=1440
> +    mformat l:
> +    NEW=1
> +fi
> +
> +
> +mcopy -D o -s $ROOT/* $ROOT_COMMON/* $ROOT_FLOPPY/* l:/
> +
> +# Grub-Konfiguration kopieren
> +mcopy -D o build/config/grub_floppy.cfg l:/boot/grub/menu.lst
> +
> +if [ $NEW -ne 0 ]; then
> +    # Grub kopieren und installieren
> +    mmd -D s l:/boot/grub
> +    mcopy -D o $LOST_GRUB_STAGESDIR/stage? l:/boot/grub/
> +
> +    echo device '(fd0)' $IMAGE_PATH > build/grub.txt
> +    echo root '(fd0)' >> build/grub.txt
> +    echo setup '(fd0)' >> build/grub.txt
> +    $LOST_TOOLS_GRUB --batch < build/grub.txt <<EOF
> +    device (fd0) $IMAGE_PATH
> +    root (fd0)
> +    setup (fd0)
> +EOF

Huch? Doppelt hält besser oder wieso trotzdem noch die Datei?

> +    rm build/grub.txt
> +fi
> +
> +# Konfigurationsdatei fuer mtools wieder loeschen
> +rm -f $MTOOLSRC
> Index: trunk/build/scripts/image_hd
> ===================================================================
> --- /dev/null
> +++ trunk/build/scripts/image_hd
> @@ -0,0 +1,110 @@
> +#!/bin/bash
> +
> +# Copyright (c) 2008 The LOST Project. All rights reserved.
> +#
> +# This code is derived from software contributed to the LOST Project
> +# by Antoine Kaufmann.
> +#
> +# Redistribution and use in source and binary forms, with or without
> +# modification, are permitted provided that the following conditions
> +# are met:
> +# 1. Redistributions of source code must retain the above copyright
> +#    notice, this list of conditions and the following disclaimer.
> +# 2. Redistributions in binary form must reproduce the above copyright
> +#    notice, this list of conditions and the following disclaimer in the
> +#    documentation and/or other materials provided with the distribution.
> +# 3. All advertising materials mentioning features or use of this software
> +#    must display the following acknowledgement:
> +#     This product includes software developed by the LOST Project
> +#     and its contributors.
> +# 4. Neither the name of the LOST Project nor the names of its
> +#    contributors may be used to endorse or promote products derived
> +#    from this software without specific prior written permission.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> PARTICULAR +# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
> HOLDERS OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
> TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
> PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
> LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +
> +ROOT=build/root
> +ROOT_COMMON=build/root-common
> +ROOT_HD=build/root-hd
> +MOUNT=build/mnt
> +SUDO=sudo
> +
> +export LOST_BUILDMK_ROOT="`pwd`"
> +source build/config/image_hd.sh
> +source config.sh
> +
> +die()
> +{
> +    echo $1
> +    exit -1
> +}
> +
> +# Wenn das Image neu erstellt werden muss, kommen noch ein paar schritte
> mehr +# dazu.
> +NEW=0
> +if ! [ -f $IMAGE_PATH ]; then
> +    # Leeres Image erstellen und formatieren
> +    dd if=/dev/zero of=$IMAGE_PATH bs=$((1024*1024)) count=$IMAGE_SIZE 2>
> /dev/null +    build/scripts/create_partition $IMAGE_PATH
> +    NEW=1
> +fi
> +
> +
> +# Start und Ende der Partition einlesen
> +PARTITIONS="`build/scripts/get_partition $IMAGE_PATH`"
> +PART_START=`echo $PARTITIONS | awk '{print $1}'`
> +PART_SIZE=`echo $PARTITIONS | awk '{print $2}'`
> +
> +if [ $NEW -ne 0 ]; then
> +    PART_IMAGE=`tempfile`
> +    dd if=$IMAGE_PATH of=$PART_IMAGE bs=512 skip=$PART_START
> count=$PART_SIZE +
> +    # Dateisystem erstellen
> +    $LOST_TOOLS_MKE2FS -F -q -r0 $PART_IMAGE || die "Dateisystem konnte
> nicht erstellt werden" +
> +    dd if=$PART_IMAGE of=$IMAGE_PATH bs=512 seek=$PART_START
> count=$PART_SIZE +    rm $PART_IMAGE
> +fi
> +
> +# Partition mounten
> +mkdir -p $MOUNT
> +$SUDO mount $IMAGE_PATH $MOUNT -o loop,offset=$((${PART_START} * 512))
> +$SUDO chmod 777 -R $MOUNT
> +
> +# Daten Kopieren
> +cp -rP --preserve=links,timestamps $ROOT/* $ROOT_COMMON/* $ROOT_HD/*
> $MOUNT/ +
> +# GRUB-Konfiguration kopieren
> +mkdir -p $MOUNT/boot/grub
> +cp build/config/grub_hd.cfg $MOUNT/boot/grub/menu.lst
> +
> +
> +# Grub kopieren
> +if [ $NEW -ne 0 ]; then
> +    cp $LOST_GRUB_STAGESDIR/stage? $MOUNT/boot/grub/
> +fi
> +
> +# Partition unmounten und loopback-Device freigeben
> +$SUDO umount $MOUNT
> +rmdir $MOUNT
> +
> +
> +# Grub installieren
> +if [ $NEW -ne 0 ]; then
> +    $LOST_TOOLS_GRUB --no-floppy --batch > /dev/null <<EOF
> +    device (hd0) $IMAGE_PATH
> +    root (hd0,0)
> +    setup (hd0)
> +EOF

Hier hast du es ja auch richtig ;-)

> +fi
> +
> Index: trunk/build/scripts/updateroot
> ===================================================================
> --- /dev/null
> +++ trunk/build/scripts/updateroot
> @@ -0,0 +1,60 @@
> +#!/bin/bash
> +
> +# Copyright (c) 2006 The LOST Project. All rights reserved.
> +#
> +# This code is derived from software contributed to the LOST Project
> +# by Kevin Wolf.
> +#
> +# Redistribution and use in source and binary forms, with or without
> +# modification, are permitted provided that the following conditions
> +# are met:
> +# 1. Redistributions of source code must retain the above copyright
> +#    notice, this list of conditions and the following disclaimer.
> +# 2. Redistributions in binary form must reproduce the above copyright
> +#    notice, this list of conditions and the following disclaimer in the
> +#    documentation and/or other materials provided with the distribution.
> +# 3. All advertising materials mentioning features or use of this software
> +#    must display the following acknowledgement:
> +#     This product includes software developed by the LOST Project
> +#     and its contributors.
> +# 4. Neither the name of the LOST Project nor the names of its
> +#    contributors may be used to endorse or promote products derived
> +#    from this software without specific prior written permission.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
> PARTICULAR +# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
> HOLDERS OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
> TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
> PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
> LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +
> +
> +ROOT=build/root
> +OUTPUT=build/output
> +
> +# Verzeichnisstruktur anlegen
> +mkdir -p $ROOT/boot/grub
> +mkdir -p $ROOT/apps
> +mkdir -p $ROOT/modules
> +
> +# Module Komprimieren und auf Image kopieren
> +for f in $OUTPUT/modules/*; do
> +    gzip -c $f > $ROOT/modules/`basename $f .mod`
> +done
> +
> +# Anwendungen komprimieren und auf Image kopieren
> +for f in $OUTPUT/apps/*; do
> +    gzip -c $f > $ROOT/apps/`basename $f`
> +done
> +
> +# Kernel komprimieren und auf Image kopieren
> +for f in $OUTPUT/kernel/*; do
> +    gzip -c $f > $ROOT/boot/`basename $f .krn`
> +done
> +
> +

Beim Rest fällt mir im Moment keine Kaputtheit auf. Du kannst nach dem 
Korrigieren direkt einchecken.