Presentation is loading. Please wait.

Presentation is loading. Please wait.

Embedded Software SKKU 43 1 Tizen Bootup. Embedded Software SKKU 43 2 Bootloader overview Tizen U-boot Tizen Systemd Platform bootup Contents.

Similar presentations


Presentation on theme: "Embedded Software SKKU 43 1 Tizen Bootup. Embedded Software SKKU 43 2 Bootloader overview Tizen U-boot Tizen Systemd Platform bootup Contents."— Presentation transcript:

1 Embedded Software SKKU 43 1 Tizen Bootup

2 Embedded Software SKKU 43 2 Bootloader overview Tizen U-boot Tizen Systemd Platform bootup Contents

3 Embedded Software SKKU 43 3 Bootloader

4 Embedded Software SKKU 43 4 Bootloader – Pass Machine ID and the boot arguments to kernel Tizen bootup overview ROM codePower on Booting device Bootloader Kernel Platform

5 Embedded Software SKKU 43 5 What is boot loader ? – A boot loader is the first program which executes (before the main program i.e. kernel ) whenever a system is initialized – A boot loader is a computer program that loads the main program (i.e. operating system, kernel ) for the board after completion of the self-tests Why boot loader is needed ? – Gives a development environment – Saves cost of flash writers – Give flexibility to load any operating system What is bootloader

6 Embedded Software SKKU 43 6 What are different types of boot loaders ? – Boot-ROM ( or Pre-Boot Loader) Small code which loads First stage boot loader – First Stage Boot Loader Small Piece of code that initialize the NAND/MMC & DRAM controller. – Second Stage Boot Loader Primary function of the second-stage boot loader is to Loading the kernel into RAM or jumping directly to the start of the kernel. Types of bootloader Pre- Bootloader First-Stage Bootloader Second-Stage Bootloader OS Kernel

7 Embedded Software SKKU 43 7 Exynos4412 U-boot loading process Internal ROM Internal SRAM Cortex-A9 DRAM controller DRAM Booting Device (NAND, MMC, SD, USB) eSSD controller NAND controller SD/MMC controller UART/USB 1 st BL 2 nd BL OS iROM code 1 2 3

8 Embedded Software SKKU 43 8 BL0; iRom code (boot-rom or pre-boot loader) – Simple platform independent code, stored in internal ROM – Initialize basic functions (clock, stack, heap, etc) – Load first stage boot loader (from booting device to internal SRAM) BL1; first boot loader – Simple platform independent code, stored in external memory(booting device) – Load second boot loader – Initialize NAND/MMC and DRAM controller BL2; second boot loader – Platform dependent complex code, stored in external memory – Initialize clock, UART – Load OS image from booting device to DRAM – Jump to operating system U-boot loading process

9 Embedded Software SKKU 43 9 Tools to build S-Record or U-boot images Example code for standalone applications Filesystem code (cramfs, ext2, jffs2, etc.) Header files Files generic to all architectures Networking code Power on self test Real time clock drivers Machine/arch independent API Architecture specific files Board dependent files Misc architecture independent functions Code for disk drive partition handling Documentation Commonly used device drivers U-boot directory structure /u-boot board common doc drivers include lib net examples fs rtc tools post arch disk api /u-boot

10 Embedded Software SKKU Disable all interrupts 2.Copy any initialized data from ROM to RAM 3.Zero the uninitialized data area 4.Allocate space for and initialize the stack 5.Initialize the processor’s stack pointer 6.Create and initialize the heap 7.Execute the initializers for all global data 8.Enable interrupts 9.Call main loop U-boot code sequence

11 Embedded Software SKKU U-boot code sequence Setup SP for Early Board Setup Environment (ASM->C) Calculate Addresses (SP, Dest, GD) for Relocation General Relocation Copy Binary to RAM Fix Relocation Clear BSS Setup SP for Common Board Setup Setup GD and JUMP to Final Board Setup Low Level Initialization lowlevel_init cpu_init_crit Disable MMU Invalidate and disable Instruction & data Cache Disable IRQ &FIQ. Switch to supervisor mode cpu/armv7/start.S reset() Reset CPU and Hardware cpu/armv7/start.S _start() arm/lib/crt0.S _main() Early Board Setup arm/lib/crt0.S board_init_f() arm/lib/crt0.S board_init_r() board/samsung/lowlevel_init.S lowlevel_init() cpu/armv7/start.S relocate_code() Jump into main loop

12 Embedded Software SKKU _start()/* Entry point function */ reset()/* Reset CPU configurations */ – save_boot_params() /* Save boot parameters */ – Disable the FIQ & IRQ – Switch to supervisor mode – cpu_init_crit() Invalidate I, D Cache Disable I cache if CONFIG_SYS_ICACHE_OFF Disable MMU lowlevel_init() _main()/* setup initial stack & global data. And jump to C routine for board initialization */ U-boot code sequence

13 Embedded Software SKKU board_init_f() – arch_cpu_init// basic arch cpu dependent setup – board_early_init_f// early board initialization, UART pin setting – timer_init// initialize timer – env_init// initialize mmc/sdcard environment – init_baudrate// initialize baudrate settings – serial_init// serial communication setup – console_init_f// stage 1 init of console, configure console from console.c – display_banner// say that we are here, print u-boot banner – print_cpuinfo// display cpu info – checkboard// display board info – init_func_i2c// initialize I2C – dram_init// configure available RAM backs – arm_pci_init U-boot code sequence

14 Embedded Software SKKU board_init_r() – board_init// setup chipselects specific configuration – logbuff_init_ptrs// initialize default log level – mem_malloc_init// configure malloc area – nand_init mmc_init// initialize flash/mmc – env_relocate// relocate environment or set NULL – stdio_init// setup stdio ready for use – api_init// initialize API – console_init_r// fully init console as a device – arch_misc_init// miscellaneous arch dependent initialization – misc_init_r// miscellaneous platform dependent initialization – interrupt_init// set up exceptions – enable_interrupts// enable exceptions – board_late_init// board late initialization – eth_initialize// setup ethernet – main_loop// jump to main loop & waiting for commands from console U-boot code sequence

15 Embedded Software SKKU U-boot code sequence Jump to kernel image address main_loop() Autoboot_mode() Command_mode() boot()loads()flash()tftpboot() Input command Wait for 3 secondsKey pressed within 3 seconds

16 Embedded Software SKKU Loading through U-boot SDRAM Root File-System Kernel Booting device Kernel Image Bootloader uboot Root File System Reset Bootloader uboot CPU Optional compressed

17 Embedded Software SKKU Packing uImage – When the kernel is complied, mkimage attaches image_header to kernel image Unpacking uImage – Magin number  CRC check  decompress  get board information  kernel booting Loading through U-boot #define IH_MAGIC 0x /* Image Magic Number */ #define IH_NMLEN 32/* Image Name Length */ typedef struct image_header { uint32_t ih_magic;/* Image Header Magic Number */ uint32_t ih_hcrc;/* Image Header CRC Checksum */ uint32_t ih_time;/* Image Creation Timestamp */ uint32_t ih_size;/* Image Data Size */ uint32_t ih_load;/* Data Load Address */ uint32_t ih_ep;/* Entry Point Address */ uint32_t ih_dcrc;/* Image Data CRC Checksum */ uint8_t ih_os;/* Operating System */ uint8_t ih_arch;/* CPU architecture */ uint8_t ih_type;/* Image Type */ uint8_t ih_comp;/* Compression Type */ uint8_t ih_name[IH_NMLEN];/* Image Name */ } image_header_t;

18 Embedded Software SKKU Architecture dependent setup – setup_arch() [/arch/arm/kernel/setup.c] Exception(or trap) initialization – trap_init() [/arch/arm/kernel/trap.c] Interrupt initialization – init_IRQ() [/arch/arm/kernel/irq.c] – sotfirq_init() [/kernel/sotfirq.c] Scheduler initialization – sched_init() [/kernel/sched.c] Timer initialization – time_init() [/arch/XXX/kernel/time.c] Console initialization – console_init() [/driver/char/tty_io.c] Module initialization – init_module() [/kernel/module.c] start_kernel

19 Embedded Software SKKU Memory & System initialization, Cache & Buffer initialization, File system initialization – kmem_cache_init() [/mm/slab.c] – mem_init() [/arch/a,r/mm/init.c] – kmem_cache_size() [/mm/slab.c] – fork_init() [/kernel/fork.c] – proc_caches_init() [/kernel/fork.c] – vfs_caches_init() [/fs/dcache.c] – buffer_init() [/fs/buffer.c] – page_cache_init() [/mm/filemap.c] – signals_init() [/kernel/signal.c] – proc_root_init() [/fs/proc/root.c] – ipc_init() [/ipc/util.c] init process creation – rest_init() [/init/main.c] start_kernel

20 Embedded Software SKKU systemd

21 Embedded Software SKKU Sysvinit – userspace launch (PID 1) – Only one process at a time running – Simply starting the system and then going to sleep until the next reboot Systemd – Default init in Fedora 15 and later Leonard Poettering (2009) – improve the software framework for expressing dependencies – allow more processing to be done concurrently or in parallel during system booting – reduce the computational overhead of the shell. What is systemd?

22 Embedded Software SKKU Systemd in Tizen – System and service manager for tizen systemd – Ver. 43 (download – Parallelizes service execution – Socket and D-Bus activation for starting services and daemon – on-demand starting of daemons – Managing the service processes as a group using Linux cgroup – Supporting automount points – Snapshotting and restoring of services What is systemd?

23 Embedded Software SKKU systemd architecture

24 Embedded Software SKKU systemd Utility – monitoring and controlling systemd itself and its services – 'systemctl' developers can query or send control commend to the systemd service manager – 'systemd-journalctl' utility to see log message systemd target – Tizen boot-up process is split up in various discrete steps and each step are grouped its unit using 'Target' unit to synchronize point – The boot-up process is highly parallelized in each target so that the order in which specific target units are reached in not deterministic systemd daemon – system and service manager for Tizen platform – acts as init system – 'systemd' daemonruns as user session with '--user' option – 'systemd-journald' is a system service that collects and stores log data from the Kernel, from user processes via syslog or STDOUT/STDERR systemd architecture

25 Embedded Software SKKU systemd core – manages all units such as service, socket, mount and so on, stores all log data. – controlled by using systemd utility like 'systemctl' systemd library & Linux Kernel – systemd requires to enable 'cgroup' and 'autofs' option in Kernel configuration – It also depends on dbus and some libraries such as libnotify, libudev systemd architecture

26 Embedded Software SKKU Early boot-up scripts – Most of file system are mounted and systemd related daemons are launched Platform bootup – sysinit.target basic.target sysinit.target multi-user.target graphical.target bootmode.target Kernel local-fs.target swap.target socket.target -.mount boot.mount csa.mount fsck-root.service media.mount opt-usr.mount opt.mount remount-rootfs.service resize2fs-root.service systemd-remount-api-vfs.service var-run.mount dev-hugepages.mount dev-mqueue.mount proc-sys-fs- binfmt_misc.automount sys-fs-fuse-connections.mount sys-kernel-config.mount sys-kernel-debug.mount sys-kernel-security.mount systemd-ask-password- console.path systemd-binfmt.service systemd-journald.service systemd-modules-load.service systemd-random-seed- load.service systemd-readahead-collect.service systemd-readahead-replay.service systemd-sysctl.service systemd-tmpfiles-setup.service dbus.socket systemd-initctl.socket systemd-journald.socket systemd-shutdownd.socket telnetd.socket udev-control.socket udev-kernel.socket

27 Embedded Software SKKU Basic boot-up – All necessary initialization for general purpose daemons are completed Platform bootup – basic.target basic.target sysinit.target multi-user.target graphical.target bootmode.target Kernel opt-var-kdb-db-libsqlfs.service opt-var-kdb-db-smack-labels.service smack-default-labeling.service systemd-tmpfiles-clean.timer tizen-debug-level.service udev-trigger.service udev.service vconf-setup.service

28 Embedded Software SKKU Select boot mode – If kernel boot parameter has ‘charger_detect_boot’, the platform boots up as charging mode Platform bootup – bootmote.target basic.target sysinit.target multi-user.target graphical.target bootmode.target Kernel bootmode-charging.service bootmode-graphical.service

29 Embedded Software SKKU Setup a multi-user system which is non-graphical support – Launching platform infrastructure daemons (such as dbus, power manager, gps manager, telephony daemon, WRT security daemon, media server, systemd-related daemons) Platform bootup – multi-user.target basic.target sysinit.target multi-user.target graphical.target bootmode.target Kernel alarm-server.service avsystem.service bluetooth-address.service bluetooth-frwk-service.service bluetooth.service dbus.service dlog-main.service dlog-radio.service getty.target gps-manager.service media-server.service nfc-manager.service power-manager.service pulseaudio.service secure-storage.service sensor-framework.service system-server.service systemd-ask-password-wall.path systemd-logind.service systemd-user-sessions.service telephony.service

30 Embedded Software SKKU Setup a graphical environment – System user session for app privilege daemons such as Enlightenment (window manager) – Special target for middleware & mobile service Platform bootup – graphical.target basic.target sysinit.target multi-user.target graphical.target bootmode.target Kernel core-efl.target tizen-middleware.target boot-animation.service cbhm.service e17.service indicator.service osp-app-service.service quickpanel.service scim.service starter.path xmodmap.service xrdb.service ac.service calendar.service contacts-service.service download-provider.service .service msg-service.service pushd.service sound-server.service tizen-mobile-session.target wrt-preinstall-widgets.service xorg.target xorg.service

31 Embedded Software SKKU Systemd parsing

32 Embedded Software SKKU systemd – Control is moved from initramfs to systemd of Tizen platform – Run hardware init and fs mount, etc services – Bootup process run several units (.target) Different target can be run in parallel – Many linux distributions adopt systemd as default Red Hat Enterprise Linux, CentOS, Fedora, Arch Linux, openSUSE – Do not use daemon control script (/sbin/init, /etc/init.d/*, /etc/rc*.d) – /usr/lib/systemd unit files: service, target, socket, device, mount, automount, path, snapshot, swap, timer systemd utilities: systemctl, notify, analyze, cgis, cgtop, logictl, journalctl, nspawn Platform bootup

33 Embedded Software SKKU https://wiki.tizen.org/wiki/Porting_Guide Platform bootup entry point.target vs.service.target; service grouping.service; process run

34 Embedded Software SKKU /usr/lib/systemd/system cat sysinit.target Parsing unit file – example (1/8) target to parse

35 Embedded Software SKKU Website – systemd download – Parsing unit file – example (2/8) manpage

36 Embedded Software SKKU Parsing unit file – example (3/8) Can search all function and unit, configuration of systemd enter target index

37 Embedded Software SKKU Parsing unit file – example (4/8) target unit file

38 Embedded Software SKKU Parsing unit file – example (5/8) Description on unit file option

39 Embedded Software SKKU Parsing unit file – example (6/8)

40 Embedded Software SKKU Parsing unit file – example (7/8)

41 Embedded Software SKKU Parsing unit file – example (8/8) User awareness unit name = “System Initialization” If emergency is running, wait Run with local-fs.target, swap.target, sysinit.target.wants Run after local-fs.target, swap.target, emergency.service, emergency.target User can control service start and stop

42 Embedded Software SKKU [Unit], [Service], [Install], [Socket], [Swap], [Mount], … – example; telephony.service – [Unit]; general options unit name = Telephony daemon Run after modem.service – [Service]; process options Run telephony-daemon as main process – [Install]; actual work of unit excute Create telephony.service symlink at multi-user.target.wants Different Sessions

43 Embedded Software SKKU 43 systemd official Site systemd FAQ (written by developer) – References


Download ppt "Embedded Software SKKU 43 1 Tizen Bootup. Embedded Software SKKU 43 2 Bootloader overview Tizen U-boot Tizen Systemd Platform bootup Contents."

Similar presentations


Ads by Google