From: Jaehoon Chung Date: Mon, 28 Oct 2024 04:05:59 +0000 (+0900) Subject: board: raspberrypi: rpi: Add tizen_rpi.env file for Tizen X-Git-Tag: accepted/tizen/unified/20241126.175211~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=690f630d3b76e7c11e788c4f7443e0e6df4f7b0b;p=platform%2Fkernel%2Fu-boot.git board: raspberrypi: rpi: Add tizen_rpi.env file for Tizen Add tizen_rpi.env file for using tizen specific environment. It will be replaced the rpi.env with CONFIG_ENV_SOURCE_FILE. Change-Id: Ia5a0d7817ff9f28a30f3a194738659f37a26d158 Signed-off-by: Jaehoon Chung --- diff --git a/board/raspberrypi/rpi/tizen_rpi.env b/board/raspberrypi/rpi/tizen_rpi.env new file mode 100644 index 0000000000..89e8fd8376 --- /dev/null +++ b/board/raspberrypi/rpi/tizen_rpi.env @@ -0,0 +1,162 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +/* environment for Raspberry Pi boards */ +/* Environment */ +stdin=serial +stdout=serial +stderr=serial + +/* + * Memory layout for where various images get loaded by boot scripts: + * + * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this. + * + * Older versions of the boot firmware place the firmware-loaded DTB at 0x100, + * newer versions place it in high memory. So prevent U-Boot from doing its own + * DTB + initrd relocation so that we won't accidentally relocate the initrd + * over the firmware-loaded DTB and generally try to lay out things starting + * from the bottom of RAM. + * + * kernel_addr_r has different constraints on ARM and Aarch64. For 32-bit ARM, + * it must be within the first 128M of RAM in order for the kernel's + * CONFIG_AUTO_ZRELADDR option to work. The kernel itself will be decompressed + * to 0x8000 but the decompressor clobbers 0x4000-0x8000 as well. The + * decompressor also likes to relocate itself to right past the end of the + * decompressed kernel, so in total the sum of the compressed and + * decompressed kernel needs to be reserved. + * + * For Aarch64, the kernel image is uncompressed and must be loaded at + * text_offset bytes (specified in the header of the Image) into a 2MB + * boundary. The 'booti' command relocates the image if necessary. Linux uses + * a default text_offset of 0x80000. In summary, loading at 0x80000 + * satisfies all these constraints and reserving memory up to 0x02400000 + * permits fairly large (roughly 36M) kernels. + * + * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't + * conflict with something else. Reserving 1M for each of them at + * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty. + * + * On ARM, both the DTB and any possible initrd must be loaded such that they + * fit inside the lowmem mapping in Linux. In practice, this usually means not + * more than ~700M away from the start of the kernel image but this number can + * be larger OR smaller depending on e.g. the 'vmalloc=xxxM' command line + * parameter given to the kernel. So reserving memory from low to high + * satisfies this constraint again. Reserving 1M at 0x02600000-0x02700000 for + * the DTB leaves rest of the free RAM to the initrd starting at 0x02700000. + * Even with the smallest possible CPU-GPU memory split of the CPU getting + * only 64M, the remaining 25M starting at 0x02700000 should allow quite + * large initrds before they start colliding with U-Boot. + */ +#ifdef CONFIG_ARM64 +fdt_high=ffffffffffffffff +initrd_high=ffffffffffffffff +#else +fdt_high=ffffffff +initrd_high=ffffffff +#endif +kernel_addr_r=0x00080000 +scriptaddr=0x02400000 +pxefile_addr_r=0x02500000 +fdt_addr_r=0x02600000 +ramdisk_addr_r=0x02700000 + +boot_targets=mmc usb pxe dhcp + +/* Distro command */ +boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr} +boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt addr -q ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi +boot_efi_bootmgr=if fdt addr -q ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi +boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf} +boot_net_usb_start=usb start +boot_pci_enum=pci enum +boot_prefixes=/ /boot/ +boot_script_dhcp=boot.scr.uimg +boot_scripts=boot.scr.uimg boot.scr +boot_syslinux_conf=extlinux/extlinux.conf +bootcmd=run distro_bootcmd +bootcmd_dhcp=devtype=dhcp; run boot_net_usb_start; run boot_pci_enum; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00011:UNDI:003000;setenv bootp_arch 0xb;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr -q ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci; +bootcmd_mmc=devnum=0; run mmc_boot +bootcmd_pxe=run boot_net_usb_start; run boot_pci_enum; dhcp; if pxe get; then pxe boot; fi +bootcmd_usb=devnum=0; run usb_boot +distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done +scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi; +scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then part uuid ${devtype} ${devnum}:${distro_bootpart} distro_bootpart_uuid ; run scan_dev_for_boot; fi; done; setenv devplist +scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;run boot_efi_bootmgr;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootaa64.efi; then echo Found EFI removable media binary efi/boot/bootaa64.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile +scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo EXTLINUX FAILED: continuing...; fi +scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done +mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi +usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi + +/* Tizen Specific */ +#ifdef CONFIG_ARM64 +#define KERNEL_NAME Image +#else +#define KERNEL_NAME zImage +#endif + +#define SET_INFORM_PART part number ${devtype} ${devnum} ${informname} informpart; + +#define SET_TO_PARTITION_X(val) SET_INFORM_PART \ + if test -e ${devtype} ${devnum}:${informpart} ${slotfile}; then; \ + load ${devtype} ${devnum}:${informpart} ${slot_addr} /${slotfile} 2; \ + fi; \ + mw.b ${slot_addr} val; \ + ext4write ${devtype} ${devnum}:${informpart} ${slot_addr} /${slotfile} 2 + +#define CLEAR_REBOOT_PARAM \ + SET_INFORM_PART \ + mw.l ${rebootparam_addr} ${normal_val}; \ + ext4write ${devtype} ${devnum}:${informpart} ${rebootparam_addr} /${rebootparamfile} 8 + +#ifdef CONFIG_TARGET_RPI_4_32B +#define TIZEN_VC_MEM vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 swiotlb=8192 +#else +#define TIZEN_VC_MEM vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 +#endif + +kernel=KERNEL_NAME +dfu_alt_info=Image fat 0 1; bcm2710-rpi-3-b.dtb fat 0 1; \ + bcm2837-rpi-3-b.dtb fat 0 1; \ + bcm2710-rpi-3-b-plus.dtb fat 0 1; \ + bcm2711-rpi-4-b.dtb fat 0 1; \ + u-boot.bin fat 0 1; \ + uboot.env fat 0 1; \ + boot.scr.uimg fat 0 1; \ + zImage fat 0 1; \ + boot.img part 0 1; \ + rootfs part 0 2; \ + system-data part 0 3; \ + user part 0 5; \ + module part 0 6; \ + ramdisk.img part 0 7; \ + ramdisk-recovery part 0 8; \ + hal.img part 0 10 +informpart=9 +rebootparamfile=reboot-param.bin +upgradetypefile=upgrade-type.info +slotfile=partition-ab.info +slot_addr=0x02200000 +rebootparam_addr=0x02100000 +upgradetype_addr=0x02300000 +upgradetype_online_val=696c6e6f +upgrade_val=72677075 +recovery_val=72766372 +nodef_val=6665646e +normal_val=6d726f6e +download_val=6c6e7764 +tfm=setenv bootmode download; run set_to_part_a; run bootcmd +opts=loglevel=4 +dfu_usb_con=0 +dfu_interface=mmc +dfu_device= __stringify(CONFIG_MMC_DEFAULT_DEV) +set_to_part_a=SET_TO_PARTITION_X("0x61") +set_to_part_b=SET_TO_PARTITION_X("0x62") +disable_delay=setenv console console=ram; setenv bootdelay 0; saveenv +enable_delay=env delete console; setenv bootdelay 2; saveenv +gpt_parts= GPT_PARTS_DEFAULT +update_gpt_part=gpt write ${devtype} ${devnum} ${gpt_parts} +reboot_param_clear=CLEAR_REBOOT_PARAM +opts=loglevel=4 +boot_scripts=boot.scr.uimg boot.scr +tizen_bootarg=cgroup_enable=memory TIZEN_VC_MEM 8250.nr_uarts=1 dma.dmachans=0x7f35 bcm2709.serial=0xed6687d3 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2709.uart_clock=48000000 dwc_otg.lpm_enable=0 +