summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/stand/ofwboot
AgeCommit message (Collapse)Author
2024-11-05Apply the changes in sys/lib/libsa/alloc.c 1.13 to the other copies of thatMiod Vallat
file modified to use OpenFirmware routines: ``Make the freelist best fit code a tiny bit smarter to not use a block if half or more would be wasted. Causes more effective re-use of blocks.'' Bump bootloader version in the unlikely case this misbehaves on some machines.
2024-06-26return type on a dedicated line when declaring functionsJonathan Gray
ok mglocker@
2024-04-14with empty body loops, put final semicolon on a new line for readabilityJonathan Gray
ok bluhm@ jca@
2024-03-26Implement the chmod a-x bsd.upgrade trick in the sparc64 ofwboot bootloader.Claudio Jeker
OK deraadt@ florian@ kn@
2024-01-28Force -fno-stack-protector on "boot block" that absolutely can't haveTheo de Raadt
a stack protector (probably not even a -fstack-protector-strong) because the bloat would render them unuseable. This also means the system compiler can now take on any more it wants, and all the pieces which can't use the stack protector are properly marked. ok kettenis
2023-11-09Finish clean up of old 6.7 softraid migration codeKlemens Nanni
All combos of no/CRYPTO softraid, old/new ofwboot, old/new kernel do boot. OK stsp
2023-10-06clean up old 6.7 softraid migration codeKlemens Nanni
ofwboot still passes an old/small .openbsd.bootdata size from before 6.7 when boothowto was added. Report the exact size from now on such that a future diff can rectify the corresponding check in autoconf.c:bootstrap(). All this was done to keep old/new bootloaders working with new/old kernels, but 6.7 is long gone and we should all be running current code. OK stsp
2023-06-03Remove declarations of unused local variables, an unused functionKenneth R Westerback
(get_long) and add missing {} in devsw[1] initialization. Most from 2011 NetBSD commit by tsutui. No functional change. Build tested and ok kn@
2023-06-02Missed a trailing space.Kenneth R Westerback
2023-06-01Expunge a bunch of eye searing trailing whitespace.Kenneth R Westerback
2023-05-31Remove declarations for unused search_label() local variablesKenneth R Westerback
error, i, p and poff. Fewer complaints from gcc -Wall. The same was done to the NetBSD version in 2011 by tsutui. Remove two more recent load_disklabel() comments implying that search_label() checks MBR partitions. It doesn't and never has despite the enticing names/types of the above unused variables. No functional change.
2023-05-21Typo in comment. 'parititon' -> 'partition'.Kenneth R Westerback
2023-04-25Do not attempt to write to read-only softraidKlemens Nanni
Bootloaders have no write support for softraid volumes, which manifests in, e.g. /bsd.upgrade not being stripped of its 'x' permission bit to prevent sysupgrade loops in case of upgrade failure. Set a no-write flag handled by libsa to bail out early in write calls. There should be no real behaviour change, writes just fail earlier now. sparc64 ofwboot. Crank minor. Tested on T4-2 guest domain with root on softraid.
2023-04-13remove duplicate includesJonathan Gray
ok deraadt@ miod@ krw@
2022-12-08_C_LABEL() and _ASM_LABEL() are no longer useful in the "everythingPhilip Guenther
is ELF" world. Eliminate use of them in amd64, arm64, armv7, i386, macppc, mips64, and sparc64 code. ok deraadt@ jca@ krw@
2022-10-17Fix "map" OpenFirmware call. It does not return a value according to theMark Kettenis
IEEE 1275 specification. This should fix booting on machines that would fail with something like: OF_map_phys(3fe44000,8192,fed58000,-1) failed no space for symbol table Program terminated Based on a diff provided by Harald Gutch (hgutch@netbsd). Also see NetBSD PR#56829. There were (and still are) some questions about whether this diff breaks the blade1.5k. However the failure in question might have been hardware related and subsequent testing of the equivalent kernel diff (which was just committed) was successful. So committing this in the hope it sticks to ease testing. ok miod@
2022-09-02Add softraid(4) RAID 1C boot supportKlemens Nanni
Equivalent of sys/arch/arm64/stand/efiboot/softraid_arm64.c r1.4: (commitid: Ka484R3swI5xSRWO) "Add softraid(4) RAID 1C boot support". Tell the boot loader to decrypt 1C like C volumes and check the number of disks in 1C like in 1C volumes -- no new code rquired. Tested on T4-2 guest domains "Looks reasonable" kettenis OK stsp NB: While kernel and boot loader support root on softraid on sparc64, installboot(8) still needs a pending fix for installations on multi-chunk softraid volumes. Until then, the usual installation process will fail on 1C volumes and requires manual fixup.
2022-09-01Stop setting d_bbsize and d_sbsize. Nobody has paidKenneth R Westerback
any attention for some time. ok otto@ as part of larger diff
2022-08-04Default to softraid on boot-device iff foundKlemens Nanni
root on softraid on sparc64 currently requires explicitly passing the volume name as part of the boot arguments, e.g. boot-file=sr0 boot-file=sr0a:/bsd or {ok} boot my-devalias sr0: (ofwboot always probes for softraid devices, assembles them but continues to ignore such volumes unless specified.) This is inconsistent with softraid support on other platforms and has further drawbacks when it comes to sysupgrade logic. Unless an explicit root disk was given, make ofwboot default to the softraid volume on the boot device to make root on softraid work out of the box without having to set variables or pass arguments in OpenBoot. Eventually, ofwboot's disk discovery and softraid assembly machinery will be fixed and boot-file won't be misused for softraid purposes anymore. Remove the quirky softraid paragraph from boot_sparc64(8) now that it is purely optional, expecting users from now on to either leave boot-file empty or pass a kernel filename alone. Tested on T4-2 guest domains with and without root on softraid. Feedback claudio kettenis stsp OK kettenis (previous diff) OK stsp
2022-07-27Fix reconstructed softraid bootlineKlemens Nanni
With softraid, OBP's boot-file variable aka. bootline may contain the sofraid volume name and kernel file name delimited by a double colon, e.g. "sr0", "sr0a", "sr0:", "sr0a:", "sr0:/bsd" or "sr0a:/bsd". ofwboot parses this string, may fill in optional partition number ("a") and/or optional kernel file name ("/bsd") and always prints the fully qualified string reconstructed from parts as "Booting <bootline>": {0} ok boot my-devalias sr0 [...] Boot device: /virtual-devices@100/channel-devices@200/disk@0 File and args: sr0 [...] Booting sr0:a/bsd [...] {0} ok boot my-devalias sr0a:/bsd [...] Boot device: /virtual-devices@100/channel-devices@200/disk@0 File and args: sr0a:/bsd [...] Booting sr0:a/bsd [...] Swap partition and delimiter to fix the reconstructed string, making it suitable for copy/paste: Booting sr0a:/bsd This has not been an issue since the reconstructed string is only printed and not (re)used anywhere. OK kettenis
2021-12-01Fix booting from an IDE block device on the Sun Blade 100. ApparentlyMark Kettenis
writing to disk using the Open Firmware interfaces is buggy and causes corruption of the disk. While it isn't entirely clear what versions of Open Firmware are affected, but it seems to only affect IDE drives. So if we detect an IDE drive, disable writing to it. This results in a small lose of bootloader functionality (bsd.upgrade loop prevention and flagging /etc/random.seed re-use) but that is better than losing the ability to run OpenBSD at all. Based on a diff by Ted Bullock (who did all the hard work of debugging this and coming up with a viable fix). ok deraadt@
2021-10-26Remove more occurences of O_RDONLY in our bootloaders.Patrick Wildt
"just do it" deraadt@
2021-10-24#define open O_* flags in libsa/stand.h, so that bootblocks can useTheo de Raadt
O_RDONLY rather using 0 ok beck
2021-01-30satisfy -fno-commonTheo de Raadt
2020-12-09Use daddr_t and not daddr32_t in boot media.Kenneth R Westerback
At a minimum, amd64/i386 should now boot from 4TB GPT formatted disks. More daddr32_t terminations with extreme prejudice to follow. Tested by various, in snaps for a few days. ok deraadt@
2020-06-13Load CTF section to enable DDB's "show struct"kn
Other platforms use libsa's ELFNAME(), e.g., elf64_exec() on amd64, already to load the kernel's ELF section ".SUNW_ctf". Adapt ofwboot accordingly to enable ddb(4) on sparc64 as well to utilise CTF information for commands like "show struct". Hints from mpi OK kettenis mpi
2020-05-26/etc/random.seed reuse can now be detected. The stat +T bit marks the fileTheo de Raadt
(fchmod +T by bootcode, chmod 600 by /etc/rc). If the seed is reused, and HWRNG isn't available, the kernel won't get RB_GOODSEED indication... ok kettenis
2020-05-26Implement write support for block devices and add readdir and fchmodMark Kettenis
operations where appropriate. Based on a diff from deraadt@ ok deraadt@
2020-05-26increment version numbers, due to recent RB_GOODSEED and fchmod +T changesTheo de Raadt
2020-05-25make loadrandom() return 0 for success, -1 for failure. While here,Theo de Raadt
relax the fstat() check because the system will have left the file in the right mode. ok visa kettenis
2020-05-25Pass boothowto from bootloader to kernel using .openbsd.bootdata. To makeMark Kettenis
sure that an old bootloader can boot a new kernel and a new bootloader can still boot an old kernel some hackery is needed as old kernels check for an exact size of the openbsd_bootdata struct. tested (with softraid) by kn@ ok stsp@, deraadt@
2020-03-15Teach sparc64 boot(8) about ffs2 and fix a bug while there: devopen()Otto Moerbeek
can be called multiple times so nfsys needs to be initialized to 0 each time. Note that the sparc64 bootblocks have no clue yet about ffs2 so this is not the complete solution. ok kettenis@
2020-01-04Remove BOOT_FLAGS and simplify the boot blocks logic.Mark Kettenis
From miod@
2019-10-29Use arc4 to bit-spread the 512-byte random buffer over the .openbsd.randomdataTheo de Raadt
section, which has grown a fair bit with the introduction of retguard. Mortimer discovered the repeated 512-byte sequence as retguard keys, and this resolves the issue. (Chacha does not fit on the media, so 1.5K early drop RC4 is hopefully sufficient in our KARL link universe) Version crank the bootblocks. sysupgrade -s will install new bootblocks. ok djm mortimer
2019-08-04crank version, following fchmod changeTheo de Raadt
2019-08-03Add F_WRITE support to the block layer (not yet used)Theo de Raadt
ok kettenis
2019-05-10Add bsd.upgrade support to sparc64 bootloader.Claudio Jeker
OK kettenis@ deraadt@
2018-12-31Cleanup bootloader code. Compile with -ffreestanding and add ffs.S as aClaudio Jeker
build dependency which is required because of that. Add various include files and some prototypes and change some code so that clang does not issue warnings anymore. OK kettenis@ deraadt@
2018-08-10Bump boot loader versions for softraid passphrase handling change.Joel Sing
2018-08-10Retry on incorrect passphrase for softraid crypto boot.Joel Sing
Historically, the softraid crypto support in the boot loaders has only given one attempt to provide the correct passphrase. There were a few reasons for this, including the fact that pkcs5_pbkdf2() allows an empty passphrase and that returning EPERM allowed for another attempt. With the event of KARL and the need for bsd.booted with hibernate resumption, this becomes much more of an issue - if you get the passphrase wrong you fail to resume. There are also other situations like using /etc/boot.conf to switch serial console, but an incorrect passphrase results in the config not being read. Also, bcrypt_pbkdf() does not permit empty passphrases. This reworks the softraid crypto support in the boot loaders so that it loops requesting a valid passphrase until one is provided, or an empty passphrase is entered (at which point it will abort). ok mortimer@ tb@
2018-06-26The disk specification in an Open Firmware device path depends on the busMark Kettenis
binding for the disk interface. For traditional SCSI is is simply a number; i.e. the disk at target 0 is specified by @0. For SAS there are several options but newer Oracle firmware no longer accepts the traditional SCSI target specification. The best alternative is the PHY number and the disk at PHY number 0 is specified by @p0. To determine which binding to use, we look up the device_type of the parent. If that is "scsi-sas", use the PHY number instead of the SCSI target. Fixes booting from softraid on SPARC T3 and later. ok claudio@, stsp@
2018-03-29Make sparc64 ofwboot open the softraid boot chunk early on and keep theStefan Sperling
handle open until a kernel has been loaded from the softraid volume. This works around an apparent memory leak in the firmware on T5220 which fails to load an ldom guest kernel from softraid with a "Fast Data Access MMU Miss" trap after many OF_open()/OF_close() calls. This problem goes away when we call OF_open()/OF_close() just once instead of for every block we want to read. Crank ofwboot version to 1.10. Make sure to keep working boot media around before upgrading! Softraid boot of an T5220 ldom guest (CRYPTO), and a v240 (RAID 1), have been tested and are known to work. Please report issues to bugs@. ok kettenis@
2016-11-06Do not create machine@ symlinks in obj as root during includes:, butTheo Buehler
defer their creation to later, so that they are owned by BUILDUSER. This eliminates the last root-owned files in obj/ from 'make build'. In addition, place a MACHINE == hppa test in hppa/stand/Makefile.inc to avoid creating bogus symlinks on all other archs. joint work with & ok natano, "let's try it" deraadt
2016-09-18Bump boot loader versions due to bcrypt pbkdf support.Joel Sing
2016-09-18Add bcrypt pbkdf support to the softraid crypto boot loader code.Joel Sing
Based on a diff from djm@
2016-09-13crank bootloader version after .SUNW_ctf changeJasper Lievisse Adriaanse
as discussed with jsing@ it's easier this way to ensure people have bootblocks capable of loading the section
2016-09-11Switch sparc64 boot code to libsa MI softraid.Joel Sing
2016-09-11Update header guards.Joel Sing
2016-09-11Rename softraid boot files, which are currently in an MD location. ThisJoel Sing
will allow us to bring in a MI softraid.{c,h} in lib/libsa.
2016-09-10Clean up some softraid crypto code - rename struct sr_crypto_kdf_pbkdf2 toJoel Sing
sr_crypto_pbkdf (since it is useable for more than just pkcs5_pbkdf2) and embed a struct sr_crypto_genkdf within it, rather than redeclaring the same fields. Rename SR_CRYPTOKDFT_PBKDF2 to SR_CRYPTOKDFT_PCKS5_PBKDF2 and add SR_CRYPTOKDFT_BCRYPT_PBKDF for upcoming changes.