scripts/targets/Linux-arm

113 lines
2.1 KiB
Plaintext

#$Id$
#variables
[ -z "$LD" ] && LD="cc -shared -nostdlib"
[ -z "$MKFS" ] && MKFS="mkfs.jffs2 -n -e 0x4000 -l -q -r $DESTDIR -X zlib -o"
#executables
[ -z "$DU" ] && DU="du -h"
[ -z "$MKDIR" ] && MKDIR="mkdir -p"
[ -z "$MV" ] && MV="mv -f"
[ -z "$TAR" ] && TAR="tar"
#includes
source "`dirname $0`/Apps/Devel/src/scripts/targets/Linux"
#functions
#private
_create_directories()
{
echo
echo -n "Creating missing directories:"
while true; do
echo -n " $1"
$MKDIR "$DESTDIR/$1" || exit 2
shift || break
done
echo
}
#public
target_image()
{
_create_directories 'bin' 'dev' 'etc' 'lib' 'sbin'
echo
echo -n "Fixing installation paths:"
for i in /lib/libc.so /bin/sh; do
echo -n " $i"
$MV "$DESTDIR$PREFIX$i" "$DESTDIR$i" || exit 2
done
echo
echo
echo -n "Creating device nodes:"
for i in std pty console input fb; do
echo -n " $i"
(cd "$DESTDIR/dev" && $SUDO sh /sbin/MAKEDEV "$i")
done
echo
if [ ! -z "$KERNEL_MODULES" ]; then
echo
echo "Installing kernel modules:"
#progress -ef "$KERNEL_MODULES" -- gunzip -c \
gunzip -c "$KERNEL_MODULES" \
| (cd "$DESTDIR" && $TAR -xf -) || exit 2
fi
if [ ! -x "$DESTDIR/sbin/init" ]; then
echo
echo -n "Installing init:"
cat > "$DESTDIR/sbin/init" << EOF
#!/bin/sh
echo "init called with arguments: \$@"
echo "Falling back to interactive mode:"
/bin/sh
EOF
chmod a+rx "$DESTDIR/sbin/init"
echo
fi
echo
echo "Building rootfs image:"
$MKFS "$IMAGE_IMAGE" || exit 2
$DU "$IMAGE_IMAGE"
echo
echo "Building tarball:"
OLDPWD="$PWD"
(cd "$DESTDIR" && $TAR -cvzf "$OLDPWD/$IMAGE_IMAGE.tar.gz" .) \
| while read filename; do
echo -en "\r$filename"
done || (echo && exit 2)
echo -en "\r"
$DU "$IMAGE_IMAGE.tar.gz"
}
target_ramdisk()
{
target "install" || exit 2
_create_directories 'dev' 'proc' 'mnt/cdrom' 'sbin'
echo
echo -n "Building ramdisk image:"
$MKFS "$RAMDISK_IMAGE" || exit 2
echo
$DU "$RAMDISK_IMAGE"
echo
echo -n "Compressing ramdisk:"
$GZIP "$RAMDISK_IMAGE" || exit 2
$MV "$RAMDISK_IMAGE.gz" "$RAMDISK_IMAGE" || exit 2
echo
$DU "$RAMDISK_IMAGE"
}