+ root_dir="$2"
+
+ # create root mount point
+ mount_point_root=$(mktemp)
+ rm -f $mount_point_root
+ mkdir $mount_point_root
+
+ i=1
+ sed -ne 's/^LABEL=//p' configs/${CONFIG_TYPE}/fstab-ext3 | \
+ while read name mntpt fstype extra; do
+ partition_start=$(parted -m -s "$img" "unit B" "print" | grep "^$i" | cut -d: -f2 | cut -dB -f1)
+ partition_size=$(parted -m -s "$img" "unit B" "print" | grep "^$i" | cut -d: -f4 | cut -dB -f1)
+ bs=1024
+
+ # create the filesystems/swap
+ attach_loop "$img" "$partition_start"
+ if [ "$fstype" = "ext3" ]; then
+ mke2fs -q -b $bs -L "$name" -m0 -j "$LOOP_DEV" $((partition_size / bs))
+ tune2fs -c0 -i0 "$LOOP_DEV" # XXX: this is from OLPC days; do we still want this?
+ elif [ "$fstype" = "ext2" ]; then
+ mke2fs -q -b $bs -L "$name" -m0 "$LOOP_DEV" $((partition_size / bs))
+ tune2fs -c0 -i0 "$LOOP_DEV"
+ elif [ "$fstype" = "swap" ]; then
+ mkswap -L "$name" "$LOOP_DEV" $((partition_size / bs))
+ fi
+ detach_loop "$LOOP_DEV"