tazlito rev 498

uefi: fix fat12
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed May 16 10:03:24 2018 +0200 (2018-05-16)
parents 2f9336b7c290
children 6b369e63e8f6
files tazlito
line diff
     1.1 --- a/tazlito	Mon May 14 15:57:23 2018 +0200
     1.2 +++ b/tazlito	Wed May 16 10:03:24 2018 +0200
     1.3 @@ -405,7 +405,7 @@
     1.4        n=($1%16)*256+prev
     1.5        if (n!=0) c[pos+1]=n
     1.6        pos++
     1.7 -      prev=$1/16
     1.8 +      prev=int($1/16)
     1.9        state++
    1.10        next
    1.11      }
    1.12 @@ -422,7 +422,7 @@
    1.13    for (i=1;i<=pos;i+=2) {
    1.14      if (c[i]=="") c[i]=0
    1.15      if (c[i+1]=="") c[i+1]=0
    1.16 -    if (fat==12) printf "0  %02X %02X %02X |\n",c[i]%256,(c[i+1]%16)*16+(c[i]/256)%256,(c[i+1]/16)%256
    1.17 +    if (fat==12) printf "0  %02X %1X%1X %02X |\n",c[i]%256,c[i+1]%16,(c[i]/256)%16,(c[i+1]/16)%256
    1.18      else printf "0  %02X %02X %02X %02X |\n",c[i]%256,(c[i]/256)%256,c[i+1]%256,(c[i+1]/256)%256
    1.19    }
    1.20  }' | hexdump -R | dd of="$1" seek=$((4*$efiblock+$fatsz+$resv)) \
    1.21 @@ -457,13 +457,14 @@
    1.22  				stat -c "%s %n" "$i"
    1.23  			done 2> /dev/null
    1.24  			cat >> $basedir/efi/boot/startup.nsh <<EOT
    1.25 -FS0:\\EFI\\BOOT\\$(basename $1) rw root=0x100$( ( cd $basedir/efi/boot ; \
    1.26 -ls -r rootfs*gz ) | while read f ; do [ "$efifile" == "bootx64.efi" -a \
    1.27 --s $basedir/efi/boot/${f}64 ] && f=${f}64; echo -n " initrd=/EFI/BOOT/$f";done)
    1.28 +FS0:\\EFI\\BOOT\\$(basename $1) rw root=0x100 autologin\
    1.29 +$( ( cd $basedir/efi/boot ; ls -r rootfs*gz ) | while read f ; do \
    1.30 +[ "$efifile" == "bootx64.efi" -a -s $basedir/efi/boot/${f}64 ] && \
    1.31 +f=${f}64; echo -n " initrd=/EFI/BOOT/$f";done)
    1.32  EOT
    1.33  		fi
    1.34  		shift
    1.35 -	done; } | awk '{ n+=int(($1+2047)/2048) } END { print n+1 }')
    1.36 +	done; } | sort | uniq | awk '{ n+=int(($1+2047)/2048) } END { print n+1 }')
    1.37  	[ ${fclust:-0} -eq 0 ] && return
    1.38  	local dclust=$( (cd $basedir; find efi -type d 2>/dev/null) | awk '
    1.39  		BEGIN {
    1.40 @@ -525,12 +526,12 @@
    1.41  	mkdir -p /tmp/mnt$$
    1.42  	mount -o loop $basedir/boot/isolinux/efi.img /tmp/mnt$$
    1.43  	( cd $basedir; find efi -type d | cpio -o -H newc ) | \
    1.44 -		( cd /tmp/mnt$$ ; cpio -idmu )
    1.45 +		( cd /tmp/mnt$$ ; cpio -idmu 2> /dev/null )
    1.46  	sync
    1.47  	dd if=$basedir/boot/isolinux/efi.img of=/tmp/fat$$ \
    1.48  		skip=$rsect bs=512 count=$fsect 2> /dev/null
    1.49  	( cd $basedir; find efi -type f | cpio -o -H newc ) | \
    1.50 -		( cd /tmp/mnt$$ ; cpio -idmu )
    1.51 +		( cd /tmp/mnt$$ ; cpio -idmu 2> /dev/null )
    1.52  	umount /tmp/mnt$$
    1.53  	cat /tmp/fat$$ /tmp/fat$$ | dd of=$basedir/boot/isolinux/efi.img \
    1.54  		seek=$rsect bs=512 conv=notrunc 2> /dev/null
    1.55 @@ -2030,7 +2031,7 @@
    1.56  		;;
    1.57  
    1.58  
    1.59 -	extract-distro)
    1.60 +	extract-distro|extract-iso)
    1.61  		# Extract an ISO image to a directory and rebuild the LiveCD tree.
    1.62  		#
    1.63  		check_root
    1.64 @@ -2079,13 +2080,13 @@
    1.65  		done
    1.66  
    1.67  		action 'Copying the rootfs...'
    1.68 -		cp $TMP_DIR/boot/rootfs*.?z "$TARGET/rootcd/boot"
    1.69 +		cp $TMP_DIR/boot/rootfs*.?z* "$TARGET/rootcd/boot"
    1.70  		status
    1.71  
    1.72  		# Extract initramfs.
    1.73  		cd "$TARGET/rootfs"
    1.74  		action 'Extracting the rootfs...'
    1.75 -		for i in $(ls -r $TARGET/rootcd/boot/rootfs*); do
    1.76 +		for i in $(ls -r $TARGET/rootcd/boot/rootfs*z); do
    1.77  			extract_rootfs "$i" "$TARGET/rootfs"
    1.78  		done
    1.79  		# unpack /usr