mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
xiaomi-elish / image-output-abl: shellfmt, no changes
This commit is contained in:
committed by
Jianfeng Liu
parent
46a46dc14e
commit
f5ea983f50
@@ -3,8 +3,8 @@ function post_build_image__900_convert_to_abl_img() {
|
||||
|
||||
display_alert "Converting image $version to rootfs" "${EXTENSION}" "info"
|
||||
declare -g ROOTFS_IMAGE_FILE="${DESTIMG}/${version}.rootfs.img"
|
||||
rootfs_start_sector=$(gdisk -l ${DESTIMG}/${version}.img|grep rootfs|awk '{print $2}')
|
||||
rootfs_end_sector=$(gdisk -l ${DESTIMG}/${version}.img|grep rootfs|awk '{print $3}')
|
||||
rootfs_start_sector=$(gdisk -l ${DESTIMG}/${version}.img | grep rootfs | awk '{print $2}')
|
||||
rootfs_end_sector=$(gdisk -l ${DESTIMG}/${version}.img | grep rootfs | awk '{print $3}')
|
||||
dd if=${DESTIMG}/${version}.img skip=${rootfs_start_sector} count=$((${rootfs_end_sector} - ${rootfs_start_sector})) of=${DESTIMG}/rootfs.img
|
||||
rm ${DESTIMG}/${version}.img
|
||||
old_rootfs_image_uuid=$(blkid -s UUID -o value ${DESTIMG}/rootfs.img)
|
||||
@@ -22,11 +22,10 @@ function post_build_image__900_convert_to_abl_img() {
|
||||
display_alert "Replace root partition uuid from ${old_rootfs_image_uuid} to ${new_rootfs_image_uuid} in /etc/fstab" "${EXTENSION}" "info"
|
||||
sed -i "s|${old_rootfs_image_uuid}|${new_rootfs_image_uuid}|g" ${new_rootfs_image_mount_dir}/etc/fstab
|
||||
|
||||
if [ ${#ABL_DTB_LIST[@]} -ne 0 ];then
|
||||
display_alert "Going to create abl kernel boot image" "${EXTENSION}" "info"
|
||||
gzip -c ${new_rootfs_image_mount_dir}/boot/vmlinuz-*-* > ${DESTIMG}/Image.gz
|
||||
for dtb_name in ${ABL_DTB_LIST[@]}
|
||||
do
|
||||
if [ ${#ABL_DTB_LIST[@]} -ne 0 ]; then
|
||||
display_alert "Going to create abl kernel boot image" "${EXTENSION}" "info"
|
||||
gzip -c ${new_rootfs_image_mount_dir}/boot/vmlinuz-*-* > ${DESTIMG}/Image.gz
|
||||
for dtb_name in ${ABL_DTB_LIST[@]}; do
|
||||
display_alert "Creatng abl kernel boot image with dtb ${dtb_name}" "${EXTENSION}" "info"
|
||||
cat ${DESTIMG}/Image.gz ${new_rootfs_image_mount_dir}/usr/lib/linux-image-*/qcom/${dtb_name}.dtb > ${DESTIMG}/Image.gz-${dtb_name}
|
||||
${new_rootfs_image_mount_dir}/usr/local/bin/mkbootimg.py \
|
||||
|
||||
@@ -25,7 +25,7 @@ setup_usb_network_configfs() {
|
||||
echo " Setting up an USB gadget through configfs"
|
||||
# Create an usb gadet configuration
|
||||
mkdir $CONFIGFS/g1 || echo " Couldn't create $CONFIGFS/g1"
|
||||
echo "$usb_idVendor" > "$CONFIGFS/g1/idVendor"
|
||||
echo "$usb_idVendor" > "$CONFIGFS/g1/idVendor"
|
||||
echo "$usb_idProduct" > "$CONFIGFS/g1/idProduct"
|
||||
|
||||
# Create english (0x409) strings
|
||||
@@ -33,25 +33,25 @@ setup_usb_network_configfs() {
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
echo "$deviceinfo_manufacturer" > "$CONFIGFS/g1/strings/0x409/manufacturer"
|
||||
echo "$usb_serialnumber" > "$CONFIGFS/g1/strings/0x409/serialnumber"
|
||||
echo "$usb_serialnumber" > "$CONFIGFS/g1/strings/0x409/serialnumber"
|
||||
# shellcheck disable=SC2154
|
||||
echo "$deviceinfo_name" > "$CONFIGFS/g1/strings/0x409/product"
|
||||
echo "$deviceinfo_name" > "$CONFIGFS/g1/strings/0x409/product"
|
||||
|
||||
# Create network function.
|
||||
mkdir $CONFIGFS/g1/functions/"$usb_network_function" \
|
||||
|| echo " Couldn't create $CONFIGFS/g1/functions/$usb_network_function"
|
||||
mkdir $CONFIGFS/g1/functions/"$usb_network_function" ||
|
||||
echo " Couldn't create $CONFIGFS/g1/functions/$usb_network_function"
|
||||
|
||||
# Create configuration instance for the gadget
|
||||
mkdir $CONFIGFS/g1/configs/c.1 \
|
||||
|| echo " Couldn't create $CONFIGFS/g1/configs/c.1"
|
||||
mkdir $CONFIGFS/g1/configs/c.1/strings/0x409 \
|
||||
|| echo " Couldn't create $CONFIGFS/g1/configs/c.1/strings/0x409"
|
||||
echo "USB network" > $CONFIGFS/g1/configs/c.1/strings/0x409/configuration \
|
||||
|| echo " Couldn't write configration name"
|
||||
mkdir $CONFIGFS/g1/configs/c.1 ||
|
||||
echo " Couldn't create $CONFIGFS/g1/configs/c.1"
|
||||
mkdir $CONFIGFS/g1/configs/c.1/strings/0x409 ||
|
||||
echo " Couldn't create $CONFIGFS/g1/configs/c.1/strings/0x409"
|
||||
echo "USB network" > $CONFIGFS/g1/configs/c.1/strings/0x409/configuration ||
|
||||
echo " Couldn't write configration name"
|
||||
|
||||
# Link the network instance to the configuration
|
||||
ln -s $CONFIGFS/g1/functions/"$usb_network_function" $CONFIGFS/g1/configs/c.1 \
|
||||
|| echo " Couldn't symlink $usb_network_function"
|
||||
ln -s $CONFIGFS/g1/functions/"$usb_network_function" $CONFIGFS/g1/configs/c.1 ||
|
||||
echo " Couldn't symlink $usb_network_function"
|
||||
|
||||
# Check if there's an USB Device Controller
|
||||
if [ -z "$(ls /sys/class/udc)" ]; then
|
||||
@@ -71,12 +71,12 @@ set_usbgadget_ipaddress() {
|
||||
echo "Starting dnsmasq with server ip $host_ip, client ip: $client_ip"
|
||||
# Get usb interface
|
||||
INTERFACE=""
|
||||
ip a add "${host_ip}/255.255.0.0" dev rndis0 2>/dev/null && ip link set rndis0 up && INTERFACE=rndis0
|
||||
ip a add "${host_ip}/255.255.0.0" dev rndis0 2> /dev/null && ip link set rndis0 up && INTERFACE=rndis0
|
||||
if [ -z $INTERFACE ]; then
|
||||
ip a add "${host_ip}/255.255.0.0" dev usb0 2>/dev/null && ip link set usb0 up && INTERFACE=usb0
|
||||
ip a add "${host_ip}/255.255.0.0" dev usb0 2> /dev/null && ip link set usb0 up && INTERFACE=usb0
|
||||
fi
|
||||
if [ -z $INTERFACE ]; then
|
||||
ip a add "${host_ip}/255.255.0.0" dev eth0 2>/dev/null && eth0 && INTERFACE=eth0
|
||||
ip a add "${host_ip}/255.255.0.0" dev eth0 2> /dev/null && eth0 && INTERFACE=eth0
|
||||
fi
|
||||
|
||||
if [ -z $INTERFACE ]; then
|
||||
|
||||
Reference in New Issue
Block a user