aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/x86/base-files/lib
Commit message (Collapse)AuthorAgeFilesLines
* x86/base-files: add support for Sophos SG/XG-105Stan Grishin2021-03-261-0/+8
| | | | | | | This adds detection of the Sophos SG-105 and Sophos XG-105 models and assignment of ethernet ports these models have to LAN/WAN. Signed-off-by: Stan Grishin <stangri@melmac.net>
* x86: add led driver for PC Engines APU1Andreas Eberlein2021-02-201-0/+4
| | | | | | | | | This driver adds the LED support for the PC Engines APU1. This integrates the Linux kernel driver and includes a patch to support newer firmware versions. Also the default LED configuration is updated to use the correct devices. Signed-off-by: Andreas Eberlein <foodeas@aeberlein.de>
* 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>
* treewide: drop shebang from non-executable target filesAdrian Schmutzler2020-06-164-5/+0
| | | | | | | | | | | | | | This drops the shebang from all target files for /lib and /etc/uci-defaults folders, as these are sourced and the shebang is useless. While at it, fix the executable flag on a few of these files. This does not touch ar71xx, as this target is just used for backporting now and applying cosmetic changes would just complicate things. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* 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-313-9/+24
| | | | | | | | | | | | | | | | | 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-012-1/+21
| | | | | | | | | | | | | | | | 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: don't hardcode "sysupgrade.tgz" file nameRafał Miłecki2019-09-051-2/+2
| | | | | | | | 1) Add BACKUP_FILE and use it when copying an archive to be restored after sysupgrade (on the next preinit). 2) Use CONF_TAR for copying backup prepared by the /sbin/sysupgrade 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: make sysupgrade.tgz reachable againTomasz Maciej Nowak2018-12-031-1/+1
| | | | | | | | | Moving binding mount before check for saved sysupgrade configuration made it unreachable. Fix it by moving binding mount after the check. Fixes: f78b2616 (x86: mount writable bootfs) Reported-by: Lucian Cristian <luci@powerneth.ro> Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
* Revert "x86: add intel microcode entries to grub config"John Crispin2018-11-271-4/+2
| | | | | | This reverts commit 546fced2a23557e95dd34246744c3aa6cad92fe6. Signed-off-by: John Crispin <john@phrozen.org>
* Revert "x86: add amd microcode entries to grub config"John Crispin2018-11-271-0/+12
| | | | | | This reverts commit a822283c7e56bb3b409712e0eb9af5a91aac247d. Signed-off-by: John Crispin <john@phrozen.org>
* x86: add amd microcode entries to grub configTomasz Maciej Nowak2018-11-261-12/+0
| | | | | | | | Create initrd enries for x86 images, that'll load amd microcode as early as possible. Also remove the preinit script responsible for late load of microcode. Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
* x86: add intel microcode entries to grub configTomasz Maciej Nowak2018-11-261-2/+4
| | | | | | | | | Create initrd enries for x86 images, that'll load intel microcode as early as possible. To achieve that the test module for grub is enabled which provides shell-like conditionals. Also restrict the late load of microcode to AMD processors. Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
* x86: mount writable bootfsTomasz Maciej Nowak2018-11-261-8/+4
| | | | | | | Mount boot file system with rw option to allow installation of packages which install files to /boot directory. Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
* x86: add preinit hook to reload microcodeZoltan HERPAI2018-02-111-0/+10
| | | | Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
* x86: preinit: use board_name on Sm Super ServersPhilip Prindeville2018-01-041-1/+8
| | | | | | | | | Supermicro puts "Super Server" into their product_name DMI value for a whole slew of products, making this value about as useful as not having been filled in at all. Instead, fall back on the board_name instead. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* x86: preinit: make name rewrite into reusable functionPhilip Prindeville2018-01-041-6/+10
| | | | | | | | There might be other places (such as vendor-supplied preinit scripts) where we wish to take a DMI name and clean it up in a consistent way, so make the sed command into a function. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* treewide: populate boardname and model earlierMathias Kresin2017-07-151-0/+0
| | | | | | | | | | | | | For targets using the generic board detection and board specific settings in diag.sh, the board name is still unset at the time the set_state() provided by diag.sh is called by 10_indicate_preinit. Change the execution order to ensure the boardname is populated before required the first time. Do the target specific board detection as early as possible, directly followed by the generic one to allow a seamless switch to the generic function for populating /tmp/sysinfo/. Signed-off-by: Mathias Kresin <dev@kresin.me>
* 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: keep /boot mounted for kexecDaniel Golle2017-05-051-4/+7
| | | | Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* 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-052-96/+5
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* x86: move sysupgrade.tgz only if it existsYousong Zhou2017-01-051-3/+6
| | | | | | | | To squash error messages at boot time mv: can't rename '/mnt/sysupgrade.tgz': No such file or directory Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* x86: use sysfs DMI information to populate sysinfoJo-Philipp Wich2016-06-061-0/+28
| | | | | | | | | | | | | | | | | | Use the DMI data available in sysfs to extract manufacturer and model info and write it to /tmp/sysinfo/. The data will be picked up by board_detect and can be used by e.g. LuCI to display a more appropriate model description. On an APU board the files will contain the following values: # cat /tmp/sysinfo/model PC Engines APU # cat /tmp/sysinfo/board_name pc-engines-apu Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* x86: generalize partition discovery for sysupgradeJo-Philipp Wich2016-05-242-25/+54
| | | | | | | | | | | | | | | 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-242-38/+53
| | | | | | | | | | | | | 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
* x86: remove old soekris config hacks, install a more appropriate default ↵Felix Fietkau2014-10-121-19/+0
| | | | | | | | /etc/config/network with lan+wan Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 42888
* 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
* x86: fix sysupgradeFelix Fietkau2014-03-211-1/+1
| | | | | | | | | | | | | | | | | | | Function move_config should be called after or during preinit_mount_root hook in do_mount_root function. At this state sysupgrade.tgz is not in its place during that time when do_mount_root is called. Function move_config is called later so the sysupgrade.tgz stays in root directory to the second restart when it is unpacked properly. This patch adds move_config function to preinit_mount_root hook instead of preinit_main and changes the filename of script to be called before 80_mount_root is called. It will prepare the sysupgrade archive for do_mount_root within preinit_mount_root hook. This patch solves ticket #15042 and #14088. Signed-off-by: Jiri Slachta <slachta@cesnet.cz> SVN-Revision: 39996
* 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
* preinit: move cmdline failsafe= handling ot the generic codeJohn Crispin2013-04-251-13/+0
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 36430
* Do not overload mount-call - trying to reduce confusionMirko Vogt2012-12-191-1/+1
| | | | | | | | | | | The behaviour of calling 'mount' differed depending on whether it called the busybox-mount, the mount of util-linux, the mount defined in /lib/functions.sh and /lib/functions/boot.sh /etc/preinit even included /lib/functions.sh and /lib/functions/boot.sh, both re-defining 'mount'. SVN-Revision: 34792
* 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
* x86: add grub2 iso supportFelix Fietkau2012-10-071-0/+5
| | | | SVN-Revision: 33639
* Fix sysupgrade for squashfs, jffs2 and ext4 imagesVasilis Tsiligiannis2012-06-192-16/+55
| | | | | | | * use 'fsync' with 'dd' for image writing * save config to boot partition SVN-Revision: 32465
* x86/soekris: Add script to detect soekris modelFelix Fietkau2011-01-261-0/+19
| | | | | | | | Add script to detect soekris board of net4801 and net4826. Patch from: kentarou matsuyama <matsuyama@thinktube.com> SVN-Revision: 25102