mirror of
git://soft.sys114.com/odroid-stamper
synced 2025-12-19 01:58:41 +09:00
Add to create file system with given file list
This patch will create a partition image with given file list in a file. For example, suppose we have 'vendor.list' that contains files $ cat custom/templates/oem/vendor.list /etc/hostname And give the file name 'vendor.list' to 'hooks/partition' with a certain partition list. $ cat custom/templates/oem/hooks/partition oem_mkfs_ext4 5 vendor vendor.list oem_mkfs_ext4 6 app oem_mkfs_ext4 7 lib The partition labeled by 'vendor' will contains the files as listed in 'vendor.list'. Signed-off-by: Dongjin Kim <tobetter@gmail.com> Change-Id: Ie4e80762f2d1c43c77dd941213f449dc3792fcbf
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
oem_mkfs_ext4 5 app
|
||||
oem_mkfs_ext4 6 lib
|
||||
oem_mkfs_ext4 7 etc ${rootfs_mnt}/etc
|
||||
oem_mkfs_ext4 5 vendor vendor.list
|
||||
oem_mkfs_ext4 6 app
|
||||
oem_mkfs_ext4 7 lib
|
||||
|
||||
1
custom/templates/oem/packages
Normal file
1
custom/templates/oem/packages
Normal file
@@ -0,0 +1 @@
|
||||
odroid-overlayroot
|
||||
@@ -1,4 +1,4 @@
|
||||
TOTAL_SECTORS=15523840
|
||||
TOTAL_SECTORS=15269888
|
||||
PART[0]=500
|
||||
PART[1]=500
|
||||
PART[2]=50
|
||||
|
||||
1
custom/templates/oem/vendor.list
Normal file
1
custom/templates/oem/vendor.list
Normal file
@@ -0,0 +1 @@
|
||||
/etc/hostname
|
||||
27
functions
27
functions
@@ -145,9 +145,34 @@ oem_mkfs_ext4() {
|
||||
local label=""
|
||||
|
||||
[ "x${2}" = "x" ] || label="-L ${2}"
|
||||
[ "x${src}" = "x" ] && src=${TOPDIR}/custom/oem/part${1}
|
||||
|
||||
# Build image with the file list
|
||||
if [ -f ${TOPDIR}/custom/${CUSTOMOS}/${src} ]; then
|
||||
local overlayfs_dir=${build_dir}/overlayfs
|
||||
|
||||
rm -rf ${overlayfs_dir} && mkdir -p ${overlayfs_dir}
|
||||
|
||||
while read line; do
|
||||
file=$(echo "${line}" | awk -F '#|;' '{print $1}')
|
||||
|
||||
if [ ! -z "${file}" ]; then
|
||||
if ls ${rootfs_mnt}/${file} 1>/dev/null 2>&1; then
|
||||
dir=$(dirname ${file} | uniq)
|
||||
mkdir -p ${overlayfs_dir}/${dir}
|
||||
mv ${rootfs_mnt}/${file} ${overlayfs_dir}/${dir}
|
||||
fi
|
||||
fi
|
||||
done < ${TOPDIR}/custom/${CUSTOMOS}/${src}
|
||||
|
||||
src=${overlayfs_dir}
|
||||
else
|
||||
if [ "x${src}" = "x" ]; then
|
||||
src=${TOPDIR}/custom/${CUSTOMOS}/part${1}
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d ${src} ]; then
|
||||
echo "* Creating ext4 file system to ${part} with ${src}"
|
||||
sudo mkfs.ext4 -F ${label} -d ${src} ${part} 2>/dev/null \
|
||||
|| panic "failed to create partition '${part}'"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user