forked from brl/citadel
52 lines
1.6 KiB
Plaintext
52 lines
1.6 KiB
Plaintext
inherit image_types
|
|
|
|
python set_image_size () {
|
|
import math
|
|
|
|
print("LOCAL set_image_size")
|
|
blocksize = 50000
|
|
rootfs_size = get_rootfs_size(d)
|
|
print("LOCAL rootfs_size")
|
|
|
|
rootfs_size = math.ceil(rootfs_size / blocksize) * blocksize
|
|
print("LOCAL rootfs_size")
|
|
|
|
d.setVar('ROOTFS_SIZE', str(rootfs_size))
|
|
d.setVarFlag('ROOTFS_SIZE', 'export', '1')
|
|
}
|
|
|
|
make_repro_ext4fs() {
|
|
fstype=ext4
|
|
extra_imagecmd=""
|
|
|
|
if [ $# -gt 1 ]; then
|
|
shift
|
|
extra_imagecmd=$@
|
|
fi
|
|
|
|
# If generating an empty image the size of the sparse block should be large
|
|
# enough to allocate an ext4 filesystem using 4096 bytes per inode, this is
|
|
# about 60K, so dd needs a minimum count of 60, with bs=1024 (bytes per IO)
|
|
eval local COUNT=\"0\"
|
|
eval local MIN_COUNT=\"60\"
|
|
if [ $ROOTFS_SIZE -lt $MIN_COUNT ]; then
|
|
eval COUNT=\"$MIN_COUNT\"
|
|
fi
|
|
|
|
# Create a sparse image block
|
|
bbdebug 1 Executing "dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype count=1 bs=1024"
|
|
|
|
bbdebug 1 "ROOTFS_SIZE: `${ROOTFS_SIZE}`"
|
|
bbdebug 1 Executing "make_ext4fs -vl ${ROOTFS_SIZE}k -T "1712775988" ${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype ${IMAGE_ROOTFS}"
|
|
|
|
make_ext4fs -vl ${ROOTFS_SIZE}k -T "1712775988" ${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype ${IMAGE_ROOTFS}
|
|
|
|
# Error codes 0-3 indicate successfull operation of fsck (no errors or errors corrected)
|
|
fsck.ext4 -pvD ${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype || [ $? -le 3 ]
|
|
# adding f makes it non-reproducible
|
|
|
|
# delete the lost+found dir's contents
|
|
# mount ${IMGDEPLOYDIR}/${IMAGE_NAME}.$fstype /tmp/image/
|
|
# find "-iname" /tmp/image/lost+found -type d -exec rm -r "{}" \;
|
|
}
|