Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2024-02-02 11:09:52 +08:00
commit 384aa2fc14
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
3 changed files with 17 additions and 14 deletions

View File

@ -2,16 +2,20 @@
. /lib/upgrade/common.sh
BOOTPART=/dev/mmcblk0p1
move_config() {
if [ -b $BOOTPART ]; then
local partdev
export_bootdevice && export_partdevice partdev 1 || {
partdev=mmcblk0p1
}
if [ -b "/dev/$partdev" ]; then
insmod nls_cp437
insmod nls_iso8859-1
insmod fat
insmod vfat
mkdir -p /boot
mount -t vfat -o rw,noatime $BOOTPART /boot
mount -t vfat -o rw,noatime /dev/$partdev /boot
[ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
fi
}

View File

@ -90,7 +90,7 @@ platform_copy_config() {
if export_partdevice partdev 1; then
mkdir -p /boot
[ -f /boot/kernel.img ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot
[ -f "/boot/kernel*.img" ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot
cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE"
tar -C / -zxvf "$UPGRADE_BACKUP" boot/cmdline.txt boot/config.txt
sync

View File

@ -1,10 +1,11 @@
#!/bin/sh
set -x
[ $# -eq 5 ] || {
set -e -x
if [ $# -ne 5 ]; then
echo "SYNTAX: $0 <file> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
exit 1
}
fi
OUTPUT="$1"
BOOTFS="$2"
@ -12,18 +13,16 @@ ROOTFS="$3"
BOOTFSSIZE="$4"
ROOTFSSIZE="$5"
align=4096
head=4
kernel_type=c
rootfs_type=83
sect=63
set $(ptgen -o $OUTPUT -h $head -s $sect -l 4096 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M)
set $(ptgen -o $OUTPUT -h $head -s $sect -l $align -t $kernel_type -p ${BOOTFSSIZE}M -t $rootfs_type -p ${ROOTFSSIZE}M)
BOOTOFFSET="$(($1 / 512))"
BOOTSIZE="$(($2 / 512))"
ROOTFSOFFSET="$(($3 / 512))"
ROOTFSSIZE="$(($4 / 512))"
dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc