boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

ELF.hex2 (2945B)


      1 ### Copyright (C) 2016 Jeremiah Orians
      2 ### Copyright (C) 2017 Jan Nieuwenhuizen <janneke@gnu.org>
      3 ### Copyright (C) 2020 Sanne Wouda
      4 ### This file is part of stage0.
      5 ###
      6 ### M2-Planet is free software: you can redistribute it and/or modify
      7 ### it under the terms of the GNU General Public License as published by
      8 ### the Free Software Foundation, either version 3 of the License, or
      9 ### (at your option) any later version.
     10 ###
     11 ### M2-Planet is distributed in the hope that it will be useful,
     12 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
     13 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14 ### GNU General Public License for more details.
     15 ###
     16 ### You should have received a copy of the GNU General Public License
     17 ### along with stage0.  If not, see <http://www.gnu.org/licenses/>.
     18 
     19 ### ELF-aarch64.hex2: ARMv8 AArch64 ELF header in hex2
     20 ### if you wish to use this header, you need to add :ELF_end to the end of your
     21 ### M1 or hex2 files.
     22 
     23 ## ELF Header
     24 
     25 :ELF_base
     26 7F 45 4C 46                    # e_ident[EI_MAG0-3] ELF's magic number
     27 
     28 02                             # e_ident[EI_CLASS] Indicating 64 bit
     29 01                             # e_ident[EI_DATA] Indicating little endianness
     30 01                             # e_ident[EI_VERSION] Indicating original elf
     31 
     32 03                             # e_ident[EI_OSABI] Set at 3 because FreeBSD is strict
     33 00                             # e_ident[EI_ABIVERSION] Set at 0 because noone cares
     34 
     35 00 00 00 00 00 00 00           # e_ident[EI_PAD]
     36 02 00                          # e_type Indicating Executable
     37 B7 00                          # e_machine Indicating AArch64
     38 01 00 00 00                    # e_version Indicating original elf
     39 
     40 &_start 00 00 00 00            # e_entry Address of the entry point
     41 %ELF_program_headers>ELF_base 00 00 00 00 # e_phoff Address of program header table
     42 00 00 00 00 00 00 00 00 # e_shoff Address of section header table
     43 
     44 00 00 00 00                    # e_flags
     45 40 00                          # e_ehsize Indicating our 64 Byte header
     46 
     47 38 00                          # e_phentsize size of a program header table
     48 01 00                          # e_phnum number of entries in program table
     49 
     50 00 00                          # e_shentsize size of a section header table
     51 00 00                          # e_shnum number of entries in section table
     52 
     53 00 00                          # e_shstrndx index of the section names
     54 
     55 ## Program Header
     56 :ELF_program_headers
     57 01 00 00 00                   # ph_type: PT-LOAD = 1
     58 07 00 00 00                   # ph_flags: PF-X|PF-W|PF-R = 7
     59 00 00 00 00 00 00 00 00                   # ph_offset
     60 
     61 &ELF_base 00 00 00 00                     # ph_vaddr
     62 &ELF_base 00 00 00 00                     # ph_physaddr
     63 
     64 %ELF_end>ELF_base 00 00 00 00             # ph_filesz
     65 00 00 80 00 00 00 00 00                   # ph_memsz = 8 MB (boot2: BSS past ELF_end)
     66 
     67 01 00 00 00 00 00 00 00                   # ph_align
     68 
     69 :ELF_text