August 17, 2018

Samsung s5p6818, Nexell, FIP, and booting

There are a lot of mysteries with regard to how boards with the Samsung S5P6818 chip boot.

Artik

Here are the last stages of the U-Boot build messages:
  aarch64-linux-gnu-ld.bfd   -pie  --gc-sections -Bstatic -Ttext 0x43C00000 -o u-boot -T u-boot.lds arch/arm/cpu/armv8/start.o --start-group  arch/arm/cpu/built-in.o  arch/arm/cpu/armv8/built-in.o  arch/arm/lib/built-in.o  arch/arm/mach-nexell/built-in.o  board/s5p6818/artik710_raptor/built-in.o  common/built-in.o  disk/built-in.o  drivers/built-in.o  drivers/dma/built-in.o  drivers/gpio/built-in.o  drivers/i2c/built-in.o  drivers/mmc/built-in.o  drivers/mtd/built-in.o  drivers/mtd/onenand/built-in.o  drivers/mtd/spi/built-in.o  drivers/net/built-in.o  drivers/net/phy/built-in.o  drivers/pci/built-in.o  drivers/power/built-in.o  drivers/power/battery/built-in.o  drivers/power/charger/built-in.o  drivers/power/fuel_gauge/built-in.o  drivers/power/mfd/built-in.o  drivers/power/pmic/built-in.o  drivers/power/regulator/built-in.o  drivers/serial/built-in.o  drivers/spi/built-in.o  drivers/usb/dwc3/built-in.o  drivers/usb/emul/built-in.o  drivers/usb/eth/built-in.o  drivers/usb/gadget/built-in.o  drivers/usb/gadget/udc/built-in.o  drivers/usb/host/built-in.o  drivers/usb/musb-new/built-in.o  drivers/usb/musb/built-in.o  drivers/usb/phy/built-in.o  drivers/usb/ulpi/built-in.o  dts/built-in.o  fs/built-in.o  lib/built-in.o  net/built-in.o  test/built-in.o  test/dm/built-in.o --end-group -L /usr/lib/gcc/aarch64-linux-gnu/7 -lgcc -Map u-boot.map

  aarch64-linux-gnu-objcopy --gap-fill=0xff  -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn -j .dtb.init.rodata -O srec u-boot u-boot.srec
  aarch64-linux-gnu-objcopy --gap-fill=0xff  -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn -j .dtb.init.rodata -O binary  u-boot u-boot.bin

start=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_start | cut -f 1 -d ' '); end=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_end | cut -f 1 -d ' '); tools/relocate-rela u-boot.bin 0x43C00000 $start $end

tools/fip_create/fip_create --dump --bl33 u-boot.bin fip-nonsecure.bin
Firmware Image Package ToC:
---------------------------
- Non-Trusted Firmware BL33: offset=0x60, size=0x7BF78
  file: 'u-boot.bin'
---------------------------
Creating "fip-nonsecure.bin"
Creating "fip-nonsecure.img" (<-- tools/nexell/nsih/nanopi3.txt)

tools/nexell/SECURE_BINGEN -c S5P6818 -t 3rdboot -l 0x7df00000 -e 0x00000000 -n tools/nexell/nsih/nanopi3.txt -i fip-nonsecure.bin -o fip-nonsecure.img
And here are the last messages when building for xxx
  aarch64-linux-gnu-ld.bfd   -g -Ttext 0xc100000 -o examples/standalone/hello_world -e hello_world examples/standalone/hello_world.o examples/standalone/libstubs.o -L /usr/lib/gcc/aarch64-linux-gnu/7 -lgcc
  aarch64-linux-gnu-objcopy -O srec  examples/standalone/hello_world examples/standalone/hello_world.srec
  aarch64-linux-gnu-objcopy -O binary  examples/standalone/hello_world examples/standalone/hello_world.bin

  aarch64-linux-gnu-gcc -E -Wp,-MD,./.u-boot.lds.d -D__KERNEL__ -D__UBOOT__ -DCONFIG_SYS_TEXT_BASE=0x43C00000   -D__ARM__           -fno-pic  -mstrict-align  -ffunction-sections -fdata-sections -fno-common -ffixed-r9   -fno-common -ffixed-x18 -pipe -march=armv8-a  -I./arch/arm/mach-nexell/include -Iinclude   -I./arch/arm/include -include ./include/linux/kconfig.h  -nostdinc -isystem /usr/lib/gcc/aarch64-linux-gnu/7/include -DMACHDIR=arch/arm/mach-nexell -DSOCDIR=CPUDIR/s5p6818 -include ./include/u-boot/u-boot.lds.h -DCPUDIR=arch/arm/cpu/armv8 -DLD_MAJOR=2 -DLD_MINOR=29 -ansi -D__ASSEMBLY__ -x assembler-with-cpp -P -o u-boot.lds arch/arm/cpu/armv8/u-boot.lds

  aarch64-linux-gnu-ld.bfd   -pie  --gc-sections -Bstatic -Ttext 0x43C00000 -o u-boot -T u-boot.lds arch/arm/cpu/armv8/start.o --start-group  arch/arm/cpu/built-in.o  arch/arm/cpu/armv8/built-in.o  arch/arm/lib/built-in.o  arch/arm/mach-nexell/built-in.o  board/s5p6818/nanopi3/built-in.o  common/built-in.o  disk/built-in.o  drivers/built-in.o  drivers/dma/built-in.o  drivers/gpio/built-in.o  drivers/i2c/built-in.o  drivers/mmc/built-in.o  drivers/mtd/built-in.o  drivers/mtd/onenand/built-in.o  drivers/mtd/spi/built-in.o  drivers/net/built-in.o  drivers/net/phy/built-in.o  drivers/pci/built-in.o  drivers/power/built-in.o  drivers/power/battery/built-in.o  drivers/power/charger/built-in.o  drivers/power/fuel_gauge/built-in.o  drivers/power/mfd/built-in.o  drivers/power/pmic/built-in.o  drivers/power/regulator/built-in.o  drivers/serial/built-in.o  drivers/spi/built-in.o  drivers/usb/dwc3/built-in.o  drivers/usb/emul/built-in.o  drivers/usb/eth/built-in.o  drivers/usb/gadget/built-in.o  drivers/usb/gadget/udc/built-in.o  drivers/usb/host/built-in.o  drivers/usb/musb-new/built-in.o  drivers/usb/musb/built-in.o  drivers/usb/phy/built-in.o  drivers/usb/ulpi/built-in.o  dts/built-in.o  fs/built-in.o  lib/built-in.o  net/built-in.o  test/built-in.o  test/dm/built-in.o --end-group -L /usr/lib/gcc/aarch64-linux-gnu/7 -lgcc -Map u-boot.map

  aarch64-linux-gnu-objcopy --gap-fill=0xff  -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn -j .dtb.init.rodata -O srec u-boot u-boot.srec
  aarch64-linux-gnu-objcopy --gap-fill=0xff  -j .text -j .rodata -j .data -j .u_boot_list -j .rela.dyn -j .dtb.init.rodata -O binary  u-boot u-boot.bin

start=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_start | cut -f 1 -d ' '); end=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_end | cut -f 1 -d ' '); tools/relocate-rela u-boot.bin 0x43C00000 $start $end

  aarch64-linux-gnu-gcc -E -Wp,-MD,./.u-boot.cfg.d -D__KERNEL__ -D__UBOOT__ -DCONFIG_SYS_TEXT_BASE=0x43C00000   -D__ARM__           -fno-pic  -mstrict-align  -ffunction-sections -fdata-sections -fno-common -ffixed-r9   -fno-common -ffixed-x18 -pipe -march=armv8-a  -I./arch/arm/mach-nexell/include -Iinclude   -I./arch/arm/include -include ./include/linux/kconfig.h  -nostdinc -isystem /usr/lib/gcc/aarch64-linux-gnu/7/include -DMACHDIR=arch/arm/mach-nexell -DSOCDIR=CPUDIR/s5p6818 -include ./include/u-boot/u-boot.lds.h -DCPUDIR=arch/arm/cpu/armv8 -DLD_MAJOR=2 -DLD_MINOR=29 -ansi -DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o u-boot.cfg include/config.h

tools/fip_create/fip_create --dump --bl33 u-boot.bin fip-nonsecure.bin
Firmware Image Package ToC:
---------------------------
- Non-Trusted Firmware BL33: offset=0x60, size=0x77EE0
  file: 'u-boot.bin'
---------------------------
Creating "fip-nonsecure.bin"
Creating "fip-nonsecure.img" (<-- tools/nexell/nsih/nanopi3.txt)
tools/nexell/SECURE_BINGEN -c S5P6818 -t 3rdboot -l 0x7df00000 -e 0x00000000 -n tools/nexell/nsih/nanopi3.txt -i fip-nonsecure.bin -o fip-nonsecure.img


Have any comments? Questions? Drop me a line!

Tom's electronics pages / tom@mmto.org