FreeSBIE requires lots of disk I/O, first of all. Using tmpfs will help a lot but there are other slow part to it.
Indeed, it is rare that one can create a desirable result with only a single trial. I always run FreeSBIE more than several time to create a final satificing image. For each time, FreeSBIE keeps creating same packages. That is quite waistful of time.
The following patch is to solve that problem. When PKGPATH is supplied to locate where generated .tgz format packages are stored, it will pick up one if exists; otherwise, it creates a new one.
diff -urN conf/freesbie.defaults.conf conf/freesbie.defaults.conf
--- conf/freesbie.defaults.conf 2006-01-04 18:23:10.000000000 -0500
+++ conf/freesbie.defaults.conf 2006-03-28 01:30:09.000000000 -0500
@@ -41,6 +41,9 @@
# Path of the built image, use absolute path
IMGPATH=${IMGPATH:-"/usr/obj/FreeSBIE.img"}
+# Path of the pkg , use absolute path
+PKGPATH=${PKGPATH:-"/usr/obj/freesbie-pkgs"}
+
# Default parameters for the image, use diskinfo(1) to obtain yours
SECTS=${SECTS:-501760} # Total number of sectors
SECTT=${SECTT:-32} # Sectors/track
diff -urN scripts/pkginstall.sh scripts/pkginstall.sh
--- scripts/pkginstall.sh 2005-12-28 10:15:18.000000000 -0500
+++ scripts/pkginstall.sh 2007-08-30 21:01:56.000000000 -0400
@@ -144,6 +144,12 @@
echo "Copying ${totpkg} packages"
cd ${CHROOTWD}
set +e
+ if [ -n "${PKGPATH:-}" ]; then
+ mkdir -p ${PKGPATH}
+ pkgsuffix="tgz"
+ else
+ pkgsuffix="tar"
+ fi
echo -n "[0"
count=1
while read pkg; do
@@ -154,14 +160,25 @@
echo -n "."
fi
count=$((${count} + 1))
+ pkgfile=${pkg}.${pkgsuffix}
- echo "Running pkg_create -b ${pkg} ${CHROOTWD}/${pkg}.tar" >> ${LOGFILE}
- pkg_create -b ${pkg} ${CHROOTWD}/${pkg}.tar >> ${LOGFILE} 2>&1
+ if [ -n "${PKGPATH:-}" ]; then
+ if [ ! -f "${PKGPATH}/${pkgfile}" ]; then
+ echo "Running pkg_create -b ${pkg} ${PKGPATH}/${pkgfile}" >> ${LOGFILE}
+ pkg_create -b ${pkg} ${PKGPATH}/${pkgfile} >> ${LOGFILE} 2>&1
+ fi
+ echo "Hard Link ${PKGPATH}/${pkgfile} ${CHROOTWD}/${pkgfile}" >> ${LOGFILE}
+ (ln ${PKGPATH}/${pkgfile} ${CHROOTWD}/${pkgfile} || \
+ cp ${PKGPATH}/${pkgfile} ${CHROOTWD}/${pkgfile} ) >> ${LOGFILE} 2>&1
+ else
+ echo "Running pkg_create -b ${pkg} ${CHROOTWD}/${pkgfile}" >> ${LOGFILE}
+ pkg_create -b ${pkg} ${CHROOTWD}/${pkgfile} >> ${LOGFILE} 2>&1
+ fi
- echo "Running $pkgaddcmd ${chrootpkgpath}/${pkg}.tar" >> ${LOGFILE}
- $pkgaddcmd ${chrootpkgpath}/${pkg}.tar >> ${LOGFILE} 2>&1
+ echo "Running $pkgaddcmd ${chrootpkgpath}/${pkgfile}" >> ${LOGFILE}
+ $pkgaddcmd ${chrootpkgpath}/${pkgfile} >> ${LOGFILE} 2>&1
- rm ${CHROOTWD}/${pkg}.tar
+ rm ${CHROOTWD}/${pkgfile}
done < $pkgfile
echo "]"
This patch also modifies FreeSBIE not to compress packages if PKGPATH is not specified. That is it create .tar packages. Because these packages will be deleted almost immediately, it is not much worth compressing them at cost of compressions. There are few circumstances where .tgz is better than .tar package. The optimization is for majorities.
The following is how to add the patch to the port system. Once you copy the file, you have to do "make install".
# fetch http://www.ne.jp/asahi/export/uyota/patches/freesbie2-patch-pkg_create
# mv freesbie2-patch-pkg_create /usr/ports/sysutils/freesbie/files/patch-pkg_create
最近のコメント