aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/x86/base-files/lib/upgrade/platform.sh
Commit message (Collapse)AuthorAgeFilesLines
* x86: upgrade: make code comment appear as log linesYousong Zhou2020-11-111-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The comment content can be useful for readers of both the log and code Previously when dd command "records in/out" messages are not filtered like now with get_image_dd, it's not clear that these messages are for extracting boot sectors. E.g. Before == upgrade: Reading partition table from bootdisk... 37+26 records in 37+26 records out == upgrade: Reading partition table from image... After == upgrade: Reading partition table from bootdisk... == upgrade: Extract boot sector from the image 37+26 records in 37+26 records out == upgrade: Reading partition table from image... Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* x86: upgrade: use get_image_ddYousong Zhou2020-11-111-5/+5
| | | | | | | Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3140 Reported-by: Philip Prindeville <philipp@redfish-solutions.com> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Reviewed-By: Philip Prindeville <philipp@redfish-solutions.com>
* x86: upgrade: use v function for writting logsYousong Zhou2020-11-111-8/+8
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* x86: fix touching bootloader "upgraded" markYousong Zhou2020-11-021-1/+1
| | | | | | | | | | | | | | The mount point is "/tmp/boot", the path in the boot partition is "/boot/grub/upgraded". Origin of this mark b9c1cf16 ("x86: add preinit hook for bootloader upgrade") Fixes 32f675ca ("x86: fix grub-bios-setup fail during sysupgrade") Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3140 Reported-by: Philip Prindeville <philipp@redfish-solutions.com> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* x86: fix grub-bios-setup fail during sysupgrade李国2020-04-091-1/+1
| | | | | | | | | | grub-bios-setup requires two images (boot.img and core.img), but they are missing. This make an error during sysupgrade: Upgrading bootloader on /dev/sda... grub-bios-setup: error: cannot open `/tmp/boot/boot/grub/boot.img': No such file or directory. Signed-off-by: 李国 <uxgood.org@gmail.com>
* x86: generate EFI platform bootable images李国2020-03-311-7/+20
| | | | | | | | | | | | | | | | | Add EFI platform bootable images for x86 platforms. These images can also boot from legacy BIOS platform. EFI System Partition need to be fat12/fat16/fat32 (not need to load filesystem drivers), so the first partition of EFI images are not ext4 filesystem any more. GPT partition table has an alternate partition table, we did not generate it. This may cause problems when use these images as qemu disk (kernel can not find rootfs), we pad enough sectors will be ok. Signed-off-by: 李国 <uxgood.org@gmail.com> [part_magic_* refactoring, removed genisoimage checks] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* x86: add preinit hook for bootloader upgradeTomasz Maciej Nowak2020-03-011-1/+2
| | | | | | | | | | | | | | | | This commit fills the void for current OpenWrt installations which will be still on old bootloader version even after "x86: add bootloader upgrade on sysupgrade", since it performs bootloader upgrade only on sysupgrade. To keep all OpenWrt deploynents on the same GRUB version, add preinit hook, which will perform upgrade of the bootloader on first boot after sysupgrade. It's temporary solution and should be deleted, when the first release including this hook will no longer be supported by OpenWrt team. We can assume that all installations should be on current bootolader version and from there sysupgrade routine will be sufficient. Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
* x86: add bootloader upgrade on sysupgradeTomasz Maciej Nowak2020-03-011-0/+24
| | | | | | | | | | | | | | Currently bootloader always stays on the same version as when first written to boot medium (not true if partition layout changed, which will trigger sysupgrade process to write full disk image). That creates inconveniences as it always stays with same features or/and bugs. Users wishing to add support to additional modules or new version, would need to write the whole image, potentially destroying previous system configuration. To fix these, this commit adds additional routine to sysupgrade which upgrades unconditionally the bootloader to the latest state provided by OpenWrt. Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
* treewide: use new procd sysupgrade $UPGRADE_BACKUP variableRafał Miłecki2019-09-051-1/+1
| | | | | | | | | | It's a variable set by procd that should replace hardcoded /tmp/sysupgrade.tgz. This change requires the most recent procd with the commit 0f3c136 ("sysupgrade: set UPGRADE_BACKUP env variable"). Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* treewide: when copying a backup file always specify dest nameRafał Miłecki2019-09-051-1/+1
| | | | | | | $CONF_TAR shouldn't be assumed to always point to the sysupgrade.tgz. This change makes code more generic and allows refactoring $CONF_TAR. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* treewide: sysupgrade: pass "save_partitions" option to the "sysupgrade" methodRafał Miłecki2019-08-221-1/+1
| | | | | | | This explicitly lets stage2 know if partitions should be preserved. No more "touch /tmp/sysupgrade.always.overwrite.bootdisk.partmap" hack. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* x86: sysupgrade: explicitly rescan disk after writing partition tableMatthias Schiffer2017-05-291-0/+6
| | | | | | | This should ensure that the kernel partition can be mounted in platform_copy_config when its size has changed. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* x86: sysupgrade: refactor platform_do_upgradeMatthias Schiffer2017-05-291-33/+36
| | | | | | | By returning early when no upgrade device can be found and handling the SAVE_PARTITIONS=0 case differently, we can get rid of two levels of if. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* x86: sysupgrade: move partition table change check to platform_check_imageMatthias Schiffer2017-05-291-4/+25
| | | | | | | The staged sysupgrade will prevent us from using ask_bool in platform_do_upgrade; therefore, the check is moved to platform_check_image. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* x86: fix sysupgrades on disks with 4k block sizeFelix Fietkau2017-01-251-9/+2
| | | | | | | Even when the disk uses 4k blocks, the partition table still uses units of 512 byte sectors. Always use ibs=512 for the offsets Signed-off-by: Felix Fietkau <nbd@nbd.name>
* base-files: export x86 platform upgrade functions to common.shYousong Zhou2017-01-051-94/+3
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* x86: generalize partition discovery for sysupgradeJo-Philipp Wich2016-05-241-23/+50
| | | | | | | | | | | | | | | Generalize the partition discovery in sysupgrade in order to fix sysupgrade and config backup/recovery on MMC block devices which use a different naming scheme compared to mtdblock or sd* devices. The change also adds the find applet to the ramdisk utilities so that upgrade code can rely on it. The commit is based on the initial submission by Russell Senior at http://patchwork.ozlabs.org/patch/625440/ . Signed-off-by: Russell Senior <russell@personaltelco.net> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* x86: search PARTUUID in any block deviceJo-Philipp Wich2016-03-301-1/+2
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* x86: make sysupgrade work without partxJo-Philipp Wich2016-03-301-6/+28
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* x86: fix platform_export_bootpart() for Xen virtual disksHauke Mehrtens2016-04-171-1/+1
| | | | | | | | | | | | | Virtual disk devices in a Xen virtual machine (DomU) can be /dev/xvda, /dev/xvdb and so on with partitions like /dev/xdva1. Devices named like this where not considered before. This resulted in a non working sysupgrade, because the boot partition could not be found. Signed-off-by: Alexander Dahl <alex@netz39.de> Suggested-by: Matthias Schiffer <mschiffer@universe-factory.net> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 49190
* x86: preserve partition table on sysupgradeJo-Philipp Wich2016-02-091-2/+49
| | | | | | | | | | | | | | With this patch sysupgrade will write directly to the partitions instead of to the main disk. The UUID is copied from the image to the MBR as well. This prevents the mbr from being completely overwritten and losing the partition table. The -p option has been added to maintain the original behavior and overwite the entire disk with the new image. Tests have been added to ensure that the image partitions match up with the active partitions. Signed-off-by: Rob Mosher <nyt-openwrt@countercultured.net> SVN-Revision: 48682
* x86: use PARTUUID instead explicitly specifying the device by defaultJo-Philipp Wich2015-03-241-24/+46
| | | | | | | | | | | | | This changes the x86 image generation to match x86_64, using the PARTUUID for the rootfs instead of explicitly configuring the device. It unbreaks KVM with VirtIO, which uses /dev/vda2 instead of /dev/sda2. Tested in QEMU/KVM with VirtIO, VirtualBox and VMware. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> SVN-Revision: 44966
* target/linux/*/base-files/lib/upgrade/platform.sh - wrong check for ARGCJohn Crispin2014-06-021-1/+1
| | | | | | | | | | | | | | | | | | | ARGC is a 'C-ism', but not known/valid in shell-syntax - insert the correct var $# (=number of args) here. under normal conditions this had no impact, but we should at least correct it. the error was observable like this: root@box:~ [ -e "/etc/functions.sh" ] && . /etc/functions.sh root@box:~ [ -e "/lib/functions.sh" ] && . /lib/functions.sh root@box:~ . /lib/upgrade/platform.sh root@box:~ . /lib/upgrade/common.sh root@box:~ platform_check_image /tmp/myfirmware.bin ash: bad number root@box:~ echo $? 0 Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com> SVN-Revision: 40915
* kernel/base-files: clean up old code related to refreshing mtd partitions, ↵Felix Fietkau2013-07-141-6/+0
| | | | | | | | it is no longer used anywhere Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 37282
* x86: allow both old and new grub signatures in sysupgradeJo-Philipp Wich2012-10-231-1/+1
| | | | SVN-Revision: 33898
* x86: correct image magic for grub2 imagesFelix Fietkau2012-10-221-1/+1
| | | | | | | | | Sysupgrade broke on x86 when grub2 superceded grub. This patch corrects tha magic_word to be expected in grub2 combined images. Signed-off-by: Russell Senior <russell@personaltelco.net> SVN-Revision: 33890
* Fix sysupgrade for squashfs, jffs2 and ext4 imagesVasilis Tsiligiannis2012-06-191-16/+33
| | | | | | | * use 'fsync' with 'dd' for image writing * save config to boot partition SVN-Revision: 32465
* sysupgrade: fix typo in platform_do_upgrade() on x86 (closes: #7068), thanks ↵Nicolas Thill2010-04-041-1/+1
| | | | | | to acinonyx SVN-Revision: 20703
* sysupgrade: Get target device from kernel cmdline, patch from acinonyxFlorian Fainelli2010-03-281-1/+5
| | | | SVN-Revision: 20538
* sysupgrade: Dump image to sda device instead of hda (patch by Acinonyx)Jo-Philipp Wich2010-03-271-1/+1
| | | | SVN-Revision: 20514
* sysupgrade-ext2 sync before writing image, not after Sysupgrade for ext2 ↵Jo-Philipp Wich2009-07-161-1/+1
| | | | | | currently flushes the filesystem buffers after an image is written to the disk. This should happen before the image is written. SVN-Revision: 16867
* fix small logic error in x86 sysupgrade script, which prevented upgrades ↵Felix Fietkau2008-09-231-1/+1
| | | | | | from jffs2 to squashfs (#3321) SVN-Revision: 12672
* fix sysupgrade support for brcm-2.4 and brcm47xx make mtd refresh based ↵Felix Fietkau2008-09-231-0/+2
| | | | | | config append optional (leave enabled on x86) SVN-Revision: 12657
* fix sysupgrade endian issuesTravis Kemen2008-07-221-1/+1
| | | | SVN-Revision: 11900
* get rid of per-profile base-filesGabor Juhos2007-09-291-0/+27
SVN-Revision: 9069