Permalink
Browse files

narcissus: Create UBIFS image in a tmp directory and delete it later

A UBIFS might be required more than once, so we keep it in a tmp directory and delete it later
This fixes a bug introduced by commit at [1] discussed in [2]

[1] http://git.angstrom-distribution.org/cgi-bin/cgit.cgi/narcissus/commit/?id=912be148348a796f2613ebf97ee11f2a0e96530e
[2] http://lists.linuxtogo.org/pipermail/angstrom-distro-devel/2011-July/004793.html

Signed-off-by: Joel A Fernandes <agnel.joel@gmail.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
  • Loading branch information...
joelagnel authored and koenkooi committed Jul 19, 2011
1 parent a72402e commit 838baf1a3107a4ac4370f5a9e1e0389f7d48750b
Showing with 11 additions and 6 deletions.
  1. +2 −0 conf/host-config
  2. +9 −6 scripts/assemble-image.sh
View
@@ -15,6 +15,8 @@ export CACHEDIRIPK="${CACHEDIR}/ipk"
export TARGET_DIR="${WORKDIR}/work/${MACHINE}/${IMAGENAME}"
+export UBIFS_TMP_DIR="${TARGET_DIR}-ubi-tmp"
+
# Choose between pseudo and fakeroot
export PSEUDO_LOCALSTATEDIR="${TARGET_DIR}-pseudo"
export PSEUDO_BINDIR=${WORKDIR}/bin
View
@@ -146,9 +146,9 @@ if [ -e ${WORKDIR}/conf/${MACHINE}/sd ] ; then
echo "tar xzf ${TARGET_DIR}/../${IMAGENAME}-${MACHINE}.tar.gz -C /mnt/narcissus/sd_image2"
tar xzf ${TARGET_DIR}/../${IMAGENAME}-${MACHINE}.tar.gz -C /mnt/narcissus/sd_image2
- if [ -e ${TARGET_DIR}/../${IMAGENAME}-${MACHINE}.ubi ] ; then
+ if [ -e ${UBIFS_TMP_DIR}/${IMAGENAME}-${MACHINE}.ubi ] ; then
echo "Copying UBIFS image to file system:"
- mv ${TARGET_DIR}/../${IMAGENAME}-${MACHINE}.ubi /mnt/narcissus/sd_image2/boot/fs.ubi
+ cp ${UBIFS_TMP_DIR}/${IMAGENAME}-${MACHINE}.ubi /mnt/narcissus/sd_image2/boot/fs.ubi
fi
touch /mnt/narcissus/sd_image2/narcissus-was-here
@@ -187,16 +187,19 @@ function do_tar()
function do_ubifs()
{
echo "creating ubi volume"
+ mkdir -p ${UBIFS_TMP_DIR}
( cd ${TARGET_DIR}/../
echo \[ubifs\] > ubinize.cfg
echo mode=ubi >> ubinize.cfg
- echo image=${TARGET_DIR}/../${IMAGENAME}-${MACHINE}.ubifs >> ubinize.cfg
+ echo image=${UBIFS_TMP_DIR}/${IMAGENAME}-${MACHINE}.ubifs >> ubinize.cfg
echo vol_id=0 >> ubinize.cfg
echo vol_type=dynamic >> ubinize.cfg
echo vol_name=${MACHINE}-rootfs >> ubinize.cfg
echo vol_flags=autoresize >> ubinize.cfg
- echo "running: ${FAKEROOT} mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${TARGET_DIR}/../${IMAGENAME}-${MACHINE}.ubifs ${MKUBIFS_ARGS} && ubinize -o ${TARGET_DIR}/../${IMAGENAME}-${MACHINE}.ubi ${UBINIZE_ARGS} ubinize.cfg"
- ${FAKEROOT} mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${TARGET_DIR}/../${IMAGENAME}-${MACHINE}.ubifs ${MKUBIFS_ARGS} && ubinize -o ${TARGET_DIR}/../${IMAGENAME}-${MACHINE}.ubi ${UBINIZE_ARGS} ubinize.cfg )
+ echo "running: ${FAKEROOT} mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${UBIFS_TMP_DIR}/${IMAGENAME}-${MACHINE}.ubifs ${MKUBIFS_ARGS} && ubinize -o ${UBIFS_TMP_DIR}/${IMAGENAME}-${MACHINE}.ubi ${UBINIZE_ARGS} ubinize.cfg"
+ ${FAKEROOT} mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${UBIFS_TMP_DIR}/${IMAGENAME}-${MACHINE}.ubifs ${MKUBIFS_ARGS} && ubinize -o ${UBIFS_TMP_DIR}/${IMAGENAME}-${MACHINE}.ubi ${UBINIZE_ARGS} ubinize.cfg )
+ echo "running: cp ${UBIFS_TMP_DIR}/${IMAGENAME}-${MACHINE}.ubi ${TARGET_DIR}/../${IMAGENAME}-${MACHINE}.ubi"
+ cp ${UBIFS_TMP_DIR}/${IMAGENAME}-${MACHINE}.ubi ${TARGET_DIR}/../${IMAGENAME}-${MACHINE}.ubi
}
function do_jffs2()
@@ -452,7 +455,7 @@ case ${SDK} in
esac
echo "removing target dir"
-rm -rf ${PSEUDO_LOCALSTATEDIR} ${OPKG_TMP_DIR} ${TARGET_DIR}
+rm -rf ${PSEUDO_LOCALSTATEDIR} ${OPKG_TMP_DIR} ${UBIFS_TMP_DIR} ${TARGET_DIR}
exit ${RETVAL}

0 comments on commit 838baf1

Please sign in to comment.