Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood

20 views

Published on

Das U-Boot - це універсальний бутлоадер з відкритим кодом, який фактично є стандартом де-факто в світі Embedded Linux. Його використовують провідні виробники SoC у своїх продуктах протягом останнього десятиліття. У цій презентації ми детально розглянемо процес завантаження Linux та роль U-boot у ньому, висвітлимо його архітектуру (включаючи всі оновлення до версії v2019.10) та коротко розглянемо процес апстрімінгу ваших патчів в open-source ком'юніті.

Published in: Education
  • Be the first to comment

  • Be the first to like this

Embedded Fest 2019. Игорь Опанюк. Das U-boot v2019: a look under the hood

  1. 1. EMBEDDED COMPUTING MADE EASY Das U-Boot v2019: a look under the hood Igor Opaniuk 1
  2. 2. $ whoami Igor Opaniuk <igor.opaniuk@toradex.com> $ pwd /Toradex/BSP Software Engineer $ echo $OLDPWD /Linaro/Security Working Group Engineer $ ls $HOME/projects U-Boot Toradex SoMs maintainer U-Boot Android A/B updates and Verified Boot (AVB) maintainer OP-TEE Poplar maintainer $ echo $LANG en, es, fr, ua, ru, C, C++ 2
  3. 3. Agenda 1. Embedded Linux booting process 2. U-Boot internals 3. Community and upstreaming 4. Future plans and updates 5. Q/A 3
  4. 4. ● ROM code limitations ○ Knows nothing about external RAM ○ Knows nothing about peripheral devices ○ Limited size and not flexible enough ● Bootloader? ○ Resides in flash (can be upgraded) ○ External RAM, clocks, PMIC, eMMC/NAND configuration, serial console, watchdog ○ Knows how to boot different OSes ○ ... Embedded Linux booting process 4
  5. 5. ● Starts from reset exception address (fixed address, where BootROM is mapped) ● Boot ROM applies initial configurations to be able to load to SPL to SRAM (safe timings for NAND to read SPL/ USB recovery) ● UART configuration ● Clocks/PLL and pinmuxing ● External RAM configuration (proper DDR timings) to put U-Boot proper there ● Boots Linux (loads ramdisk, zImage and device tree blobs to external RAM, provides proper bootargs) Embedded Linux booting process 5
  6. 6. ● De-facto standard for booting Linux in embedded world ● ~ 20 years of active development ● 13 of architectures (ARM, x86, MIPS, RISC-V etc.) ● Support > 1400 boards ● Booting from 13 different filesystems ● Support of > 10 boot medias (eMMC, SD, usb, SCSI, SATA_ ● > 200 of active developers/contributors ● GPLv2 U-Boot: facts and numbers 6
  7. 7. ● SPL and Falcon mode ● U-Boot shell ● Driver Model and device tree support ● EFI support ● FIT images and Verified Boot ● Android boot ● U-Boot and TEE on ARMv8 ● Distroboot U-Boot internals: features 7
  8. 8. ● U-Boot proper has it’s own CLI interface ● Environment variables: key=value format ● Most commonly used commands: ○ bootm, bootz, fdt, dm, dhcp, env, reset, tftpboot, part, gpt, mmc, fastboot, nand, ping... ● Shell scripting U-Boot shell 8 mmcboot=mmc dev ${mmcdev}; devnum=${mmcdev}; setenv devtype mmc; if mmc rescan; then echo SD/MMC found on device ${mmcdev}; if run loadimage; then if test ${boot_fit} - eq 1; then run loadfit; else run mmcloados; fi;
  9. 9. SPL/TPL ● Secondary Program Loader (is booted after boot ROM) ● TPL - Third Program Loader (usually because of size limitation of SPL on some boards,init procedures are off-loaded some from SPL to TPL) ● Used for devices with limited resources (SRAM not big enough for U- Boot proper) ● Does initial hardware initialization (serial console, pinmux configuration, clocks etc.) ● Falcon boot: boot Linux directly from SPL doc/README.falcon 9
  10. 10. Driver Model and Device Trees 10 ● All device configuration are stored in DT ● “Lazy” probing (device is probed only when it’s used) ● Devices organized by classes (UCLASS) ● Support of Live trees ● Device tree live editing (f.e: add auxiliary node to Linux fdt) ● Driver Model low level access cmds
  11. 11. Driver Model 11 rn5t567@33 { compatible = "ricoh,rn5t567"; reg = <0x33>; regulators { reg_DCDC1: DCDC1 { /* V1.0_SOC */ regulator-min-microvolt = <1000000>; regulator-max-microvolt = <1100000>; regulator-boot-on; regulator-always-on; }; … };
  12. 12. Driver Model (cont) static const struct udevice_id rn5t567_ids[] = { { .compatible = "ricoh,rn5t567" }, { } }; U_BOOT_DRIVER(pmic_rn5t567) = { .name = "rn5t567 pmic", .id = UCLASS_PMIC, .of_match = rn5t567_ids, .ops = &rn5t567_ops, }; 12
  13. 13. ● API for interaction of drivers and applications with the firmware ● Implementation of the requirements described in the "Embedded Base Boot Requirements (EBBR) Specification - Release v1.0" ● U-Boot can run EFI apps using bootefi shell command ○ bootefi <image address> [fdt address] EFI 13
  14. 14. ● The new uImage format allows more flexibility in handling images of various types (kernel, ramdisk, etc.), it also enhances integrity protection of images with sha1 and md5 checksums. ● Support of FIT image parsing can be added to both SPL and U-Boot proper FIT and verified boot 14
  15. 15. ● Android 10 boot patches upstreaming is in progress ● Support for A/B seamless updates ● Android Boot images support (including v2) ● Reboot reason and Boot Control Block handling ● Android Verified Boot 2 ● Fastboot ● Dynamic partitions Android boot 15 ref: https://static.linaro.org/connect/san19/presentations/san19-217.pdf
  16. 16. Android boot 16 ref: https://static.linaro.org/connect/san19/presentations/san19-217.pdf by Sam Protsenko
  17. 17. ● ARMv8: U-Boot is usually used as non- secure bootloader ● Communication with TEE (TEE Uclass), e.g. for AVB (storing rollback indexes etc.) U-Boot and TEE 17 ref: http://www.virtualopensystems.com/en/services/arm-trusted-firmware-extended-services/
  18. 18. ● All patches must be sent to U-Boot ML: u-boot@lists.denx.de ● Patch tracking at http://patchwork.ozlabs.org/project/uboot/list/ ● Patches should conform to the Linux kernel coding style ● Release cycle - 3 months, merge window - 3 weeks ● patman: automates git format-patch/git-send-email + checkpatch.pl ● buildman: builds all/any platform ● test.py: executing U-Boot shell commands using the console interface ● Additional analysis (binary size changes etc.) Community and upstreaming 18
  19. 19. ● Fetches toolchains automatically ● Builds any platform (or all; can be selected using regex expression) ● Bisecting integration (checks which commit introduced regression etc.) ● Additional analysis (binary size changes etc.) $ ./tools/buildman/buildman -f -j10 -d colibri-* Building current source for 9 boards aarch64: w+ colibri-imx8qxp arm: w+ colibri_imx7_emmc arm: w+ colibri_pxa270 arm: w+ colibri_imx7 arm: w+ colibri_imx6 4 5 0 /9 colibri_imx6 Buildman 19
  20. 20. Author: Igor Opaniuk <igor.opaniuk@toradex.com> Date: Tue Nov 5 14:57:54 2019 +0100 imx: bootaux: elf firmware support Currently imx-specific bootaux command doesn't support ELF format firmware for Cortex-M4 core. .... Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> Series-to: u-boot Series-version: 1 Series-cc: sbabic@denx.de Patman 20 $ ./tools/patman/patman -c1 -v --no-tags Cleaned 1 patches .... Send a total of 1 patch with no cover letter. 0001-imx-bootaux-elf-firmware-support.patch Cc: Fabio Estevam <festevam@gmail.com> Cc: NXP i.MX U-Boot Team <uboot-imx@nxp.com> Cc: Simon Glass <sjg@chromium.org> Cc: Stefan Agner <stefan.agner@toradex.com> Cc: Stefano Babic <sbabic@denx.de> To: u-boot@lists.denx.de Cc: sbabic@denx.de Version: 1 Prefix: None
  21. 21. $ make qcheck ./test/run quick sandbox: +make O=/home/xdev/toradex/reps/u-boot.git/build-sandbox -s sandbox_defconfig +make O=/home/xdev/toradex/reps/u-boot.git/build-sandbox -s -j8 ======================================= test session starts ============================================= .platform linux2 -- Python 2.7.15+, pytest-3.3.2, py-1.5.2, pluggy-0.6.0 rootdir: /home/xdev/toradex/reps/u-boot.git/test/py, inifile: pytest.ini collected 515 items test/py/tests/test_000_version.py . [ 0%] test/py/tests/test_bind.py .. [ 0%] test/py/tests/test_dfu.py s [ 1%] test/py/tests/test_efi_loader.py .sssss [ 2%] ………….. ===================== 368 passed, 60 skipped, 87 deselected in 29.61 seconds ============================ PyTest 21
  22. 22. ● More drivers from the Linux kernel + sync DTS with Linux kernel tree ● Driver-model migration (doc/driver-model/migration.rst) ○ CONFIG_DM - 2020.01 ○ CONFIG_DM_ETH - 2020.07 ● Kconfig transition ● Test more and make U-Boot great again! ○ More PyTest coverage + U-Boot sandbox testing ○ More automated test farms ○ Testing on real hardware with LAVA CI Plans and updates 22
  23. 23. LAVA CI 23 ref: Linaro Connect BKK19
  24. 24. www.toradex.com | developer.toradex.com | community.toradex.com | labs.toradex.com Q & A 24
  25. 25. Arm System on Modules Reliable Long-term Maintenance Scalable From Stock Ease-of-use Support Ecosystem Production-ready Software Yocto-based Linux Windows Embedded Compact Development Tools Long-term Maintenance WHAT WE DO RELIABLE AND EASY-TO-USE EMBEDDED SOLUTIONS FOR YOU 25

×