mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
51 lines
1.3 KiB
Plaintext
51 lines
1.3 KiB
Plaintext
|
##
|
||
|
# Build U-boot bootloader specific image.itb (FIT image)
|
||
|
#
|
||
|
# \param --image-uboot-no-gzip do not gzip the image.itb
|
||
|
#
|
||
|
|
||
|
|
||
|
##
|
||
|
# Check if the image.itb should be gzipped
|
||
|
#
|
||
|
proc image_uboot_use_no_gzip { } { return [get_cmd_switch --image-uboot-no-gzip] }
|
||
|
|
||
|
|
||
|
##
|
||
|
# Build U-boot bootloader specific image.itb
|
||
|
#
|
||
|
# \param elf_img ELF binary to build image.itb from
|
||
|
#
|
||
|
proc run_image {elf_img} {
|
||
|
# parse ELF entrypoint and load address
|
||
|
set entrypoint [exec [cross_dev_prefix]readelf -h $elf_img | \
|
||
|
grep "Entry point address: " | \
|
||
|
sed -e "s/.*Entry point address: *//"]
|
||
|
set load_addr [exec [cross_dev_prefix]readelf -l $elf_img | \
|
||
|
grep -m 1 "LOAD"]
|
||
|
set load_addr [lindex [regexp -inline -all -- {\S+} $load_addr] 3]
|
||
|
|
||
|
set bin_img "[run_dir]/image.bin"
|
||
|
exec [cross_dev_prefix]objcopy -O binary $elf_img $bin_img
|
||
|
|
||
|
set use_gzip [expr ![image_uboot_use_no_gzip]]
|
||
|
set compress_type none
|
||
|
set bin_ext ""
|
||
|
|
||
|
# compress ELF
|
||
|
if $use_gzip {
|
||
|
exec gzip --best --force $bin_img
|
||
|
set bin_ext .gz
|
||
|
set compress_type gzip
|
||
|
}
|
||
|
|
||
|
set arch "arm"
|
||
|
if {[have_spec arm_64]} { set arch "arm64" }
|
||
|
|
||
|
# create image.itb
|
||
|
set uboot_img [run_dir]/image.itb
|
||
|
exec mkimage -f auto -A $arch -O linux -T kernel -C $compress_type -a $load_addr \
|
||
|
-e $entrypoint -d $bin_img$bin_ext $uboot_img
|
||
|
exec rm -rf $bin_img$bin_ext
|
||
|
}
|