In puthdr(), start the ELF .data section on a new page, as this is

what btxldr expects (.set MEM_DATA,start+0x1000 in btxldr.S).

This makes resulting ELF binaries bootable with grub, gptboot and boot2.

PR:		153801
Submitted by:	Gleb Kurtsou <gleb.kurtsou at gmail.com>
Tested by:	Ruben Kerkhof <ruben at rubenkerkhof.com>
Glanced at by:	jhb, peter
MFC after:	1 month
This commit is contained in:
Christian Brueffer 2014-02-25 17:13:42 +00:00
parent ee270bbca3
commit 419749b63a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=262484

View File

@ -426,7 +426,7 @@ puthdr(int fd, struct hdr *hdr)
le32toh(eh.p[0].p_filesz));
eh.p[1].p_vaddr = eh.p[1].p_paddr =
htole32(align(le32toh(eh.p[0].p_paddr) + le32toh(eh.p[0].p_memsz),
4));
4096));
eh.p[1].p_filesz = eh.p[1].p_memsz = htole32(hdr->data);
eh.sh[2].sh_addr = eh.p[0].p_vaddr;
eh.sh[2].sh_offset = eh.p[0].p_offset;