Skip to content

Instantly share code, notes, and snippets.

@felipec
Created September 17, 2008 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipec/11332 to your computer and use it in GitHub Desktop.
Save felipec/11332 to your computer and use it in GitHub Desktop.
rootfs helper
#!/bin/bash
## contents of ubinize.cfg
# [ubifs]
# mode=ubi
# image=/tmp/ubifs.img
# vol_id=0
# vol_size=128MiB
# vol_type=dynamic
# vol_name=rootfs
# vol_alignment=1
# vol_flags=autoresize
version="beagle"
mkfs_jffs2="/usr/sbin/mkfs.jffs2"
# use_jffs2="yes"
use_ubifs="yes"
rootfs=$1
if [ "$use_jffs2" ]
then
echo "building jffs2"
bin="/tmp/${USER}-${version}-jffs2.bin"
sudo ${mkfs_jffs2} -d ${rootfs} -e 128KiB -n -l -p -o ${bin}
fi
if [ "$use_ubifs" ]
then
echo "building ubi"
bin="/tmp/${USER}-${version}-ubi.bin"
sudo mkfs.ubifs -r ${rootfs} -m 2048 -e 129024 -c 2047 -o /tmp/ubifs.img
ubinize -o "${bin}" -m 2048 -p 128KiB -s 512 custom/ubinize.cfg
sudo rm /tmp/ubifs.img
fi
echo "rootfs: \"${rootfs}\""
[ "$bin" ] && echo "bin: \"${bin}\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment