/* * This file is part of Jehanne. * * Copyright (C) 2022 Giacomo Tesio * * Jehanne is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3 of the License. * * Jehanne is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Jehanne. If not, see . */ /* automatically generated by /sys/src/kern/build/inith.rc.template */ #! fn base10 { #! seq -f%0.0f $1 $1 #! } #! CODE=`{$READELF -W -l init|grep LOAD|sed 's/R E/R_E/'|grep R_E} #! CODE_START=`{base10 $CODE(3)} int init_code_start = $CODE_START; int init_code_end = $CODE_START + $CODE(6); int init_code_len = $CODE(6); uint8_t init_code_out[] = { #! hexdump -s $CODE(2) -n $CODE(5) -v \ #! -e '1/1 " 0x%02x, " 6/1 "0x%02x, " 1/1 " 0x%02x,\n"' \ #! init | sed '$s/0x ,//g' }; #! DATA=`{$READELF -W -l init|grep LOAD|grep RW} #! PAGE_SIZE=`{base10 $DATA(8)} #! DATA_START=`{base10 $DATA(3)} #! DATA_PAGE_START=`{echo $DATA_START d $PAGE_SIZE '%-p'|dc} #! DATA_FILE_START=`{base10 $DATA(2)} #! DATA_PADDING=`{echo $DATA_START $DATA_PAGE_START '-p'|dc} #! DATA_MEM_LENGTH=`{base10 $DATA(6)} #! DATA_MEM_LENGTH=`{echo $DATA_MEM_LENGTH $DATA_PADDING '+p'|dc} #! DATA_FILE_LENGTH=`{base10 $DATA(5)} #! TRAILING_ZEROS=`{echo `{base10 $DATA(6)} `{base10 $DATA(5)} '-p'|dc} int init_data_start = $DATA_PAGE_START; int init_data_end = $DATA_PAGE_START + $DATA_MEM_LENGTH; int init_data_len = $DATA_MEM_LENGTH; uint8_t init_data_out[] = { #! hexdump -n $DATA_PADDING -v \ #! -e '1/1 " 0x%02x, " 6/1 "0x%02x, " 1/1 " 0x%02x,\n"' \ #! /dev/zero | sed '$s/ 0x ,//g' #! hexdump -s $DATA_FILE_START -n $DATA_FILE_LENGTH -v \ #! -e '1/1 " 0x%02x, " 6/1 "0x%02x, " 1/1 " 0x%02x,\n"' \ #! init | sed '$s/ 0x ,//g' #! hexdump -n $TRAILING_ZEROS -v \ #! -e '1/1 " 0x%02x, " 6/1 "0x%02x, " 1/1 " 0x%02x,\n"' \ #! /dev/zero | sed '$s/ 0x ,//g' };