6.1 OVERVIEW OF BOOTING SEQUENCE

  S5PV210은 내부 메모리로 64KB ROM96KB SRAM을 가지고 있다. 이 두 영역은 booting을 위해 사용된다.
S5PV210은 secure booting을 enable하기 위해 내부 ROM으로부터 boot한다.  이것은 인증되지 않은 user가 이미지를 변경할 수 없게 한다. secure booting과 normal booting을 선택하기 위해,  S5PV210은 e-fuse 정보를 사용해야한다. 이 정보는 program된 후 변경될 수 없다.

Booting device

• General NAND Flash memory
• OneNAND memory
• SD/ MMC memory (such as MoviNAND and iNAND)
• eMMC memory
• eSSD memory
• UART and USB devices

system reset시, program counter는 내부 ROM 영역에서 iROM code로 부터 시작한다. 그러나 system reset은 booting time이나 또는 low power mode에서 wakeup할 때, assert될수 있다. 따라서 iROM code는 reset status로부터 적절한 process를 execute해야만 한다.

bootloader는 크게 iROM, 1st BL, 2nd BL로 구성된다.

• iROM code : small and simple code로 구성됨. platform-independent, 내부 메모리에 저장됨.
• First boot loader :  small and simple code로 구성됨. platform-independent, 외부 메모리 device에 저장, 
                              secure booting과 관련됨.
• Second boot loader: 복잡한 code로 구성됨, platform-specific, 외부 메모리 device에 저장됨.

secure booting 선택시, iROM code와 1st BL은 loaded image를 verify하기 위해 integrity checking function를 제공한다. secure boot key는 160 e-fuse bit로 되어 있으며 iROM의 integrity check전에 loaded pulict key를 인증하는데 사용된다.



• iROM code는 internal 64KB ROM에 위치한다.
   clock, stack, heap와 같은 기본적인 system function을 초기화한다.
• iROM은 명시한 booting device로부터 1st BL image를 internal 96KB SRAM으로 load한다.
   booting device는 OM(Operation Mode) pins에의해 선택된다. 
   secure boot key values에 따라 iROM code는 1st BL image에서 integrity check 작업을 수행할 수도 있다.
• 1st BL은 2nd BL를 load하고 secure boot key values에 따라 2nd BL의 integrity를 check할 수도 있다.
• 2nd BL은 system clock, UART, DRAM controller를 초기화한다.
   DRAM controller를 초기화한 후에, booting device로부터 OS image를 load한다.
   secure boot key values에 따라 2nd BL은 OS image에서 integrity check를 수행할 있다.
• 부팅이 완료된 후에, 2nd BL은 operationg system으로 jump한다.

iROM code는 booting device를 찾기위해 OM pin을 읽는다. OM 레지스터는 booting에 필요한 OM pin과 다른 정보등을 제공한다.

OM pin은 OneNAND, NAND, MoviNAND, eSSD and iNAND와 같은 booting device를 결정한다. bit width, wait cycles, page sizes, and ECC modes 같은 option들도 결정한다.

BL0 : internal 64KB ROM에  위치한 iROM code
BL1 : first boot loader


6.2 SCENARIO DESCRIPTION

6.2.1 RESET STATUS

hardware reset, watchdog reset, software reset, and wake up from power down modes과 같은 다양한 system reset 시나리오가 있다.


hardware reset and watchdog reset 시에, system은 1st, 2nd boot loader, OS image를 가지고 full boot를 해야 한다. 새로운 reset status는 reset group0로서 분류된다.

DRAM 메모리의 내용이 SLEEP mode에서 보존되었다면 DRAM으로 OS image를 loading할 필요가 없다. SoC internal power가 SLEEP mode돋안 내부 logic에 공급되지 않기때문에 내부 SRAM의 내용은 보존되지 않는다.
그러므로 first boot loader and the second boot loader는 다시 load되야 한다. reset status는 reset group1로서 분류된다.

software reset시에 boot loader의 loading은 실행된다. top block’s power가 DEEP_STOP and DEEP_IDLE modes에서 gate되었다었더라도 내부 SRAM은 reserved될 수 있다.  그래서 boot loader의 reloading은 필요없다. DEEP_STOP and DEEP_IDLE modes에서 SRAM의 non-retention의 경우 1st boot loader는 다시 load되야만 한다. DEEP_STOP and DEEP_IDLE statuses에서 wake up하는 software reset은 reset group2로 분류된다.

system이 모두 power down mode로 들어간다면, 현재 system status은 DRAM과 같은 safe memory region에 저장되어야 한다. 그래서 system은 power down mode로부터 wake up 후에 seamlessly하게 processing을 계속해야 한다.

마지막으로 이전 상태 함수를 복구하는 것은 SLEEP, DEEP_STOP, and DEEP_IDLE modes에서 필요하다.


6.2.2 BOOTING SEQUENCE EXAMPLE

Program code는 iROM에서 시작해서 iRAM으로 이동하고, 마지막으로 DRAM에서 program을 실행한다.


booting sequence in internal ROM

1. Disable the watchdog timer.

2. Initialize the instruction cache controller.

3. Initialize the stack and heap region.

4. Check secure key.

5. Set Clock divider, lock time, PLL (MPS value), and source clock.

6. Check OM pin and load the first boot loader (The size of boot loader depends on S/W) from specific 
    device (block number 0) to iRAM.

7. If secure booting is successful, execute integrity check

8. If integrity check passes, then jump to the first boot loader in iRAM (0xD002_0010)


booting sequence in internal SRAM

1. Load the second boot loader from boot device to iRAM.

2. If secure booting is successful, execute integrity check.

3. If integrity check passes, then jump to the second boot loader in iRAM (The jumping address depends
    on user's software)

4. If integrity check fails, then stop the first boot loader.

5. The second boot loader Initializes the DRAM controller.

6. Load the OS image from specific device (block number 1) to DRAM.

7. Jump to OS code in DRAM (0x2000_0000 or 0x4000_0000)


booting sequence in DRAM

1. If S5PV210 is powered on from SLEEP, DEEP_STOP, or DEEP_IDLE modes, then restore the previous
    state.

2. Jump to OS code.


6.2.3 FIXED PLL AND CLOCK SETTING

1st boot loader의 operation speed를 up하기 위해, 1st boot loader는 수정된 PLL 값으로 초기화 한다. 수정된 PLL 설정은 :

• APLL: M=200, P=6, S=1 FOUT = (MDIV X FIN )/ (PDIV X 2(SDIV-1))) = 800MHz
• MPLL: M=667, P=12, S=1 FOUT = (MDIV X FIN) / (PDIV X 2SDIV) = 667MHz
• EPLL: M=80, P=3, S=3, K=0 FOUT = ((MDIV+KDIV) X FIN) / (PDIV X 2SDIV) = 80MHz



6.2.4 OM PIN CONFIGURATION




6.2.5 SECURE BOOTING

security system의 기본적인 표준은 "‘root of trust’는 하드웨어가 되어야만 하고 'validate'하기 위해 소프트웨어 시스템을 요청할 수 없다"는 것이다.

S5PV210에서, root of trust는 내부 ROM에서 iROM code에 의해 동작된다. 그러므로 인증되 않은 user에 의해 modify될수 없다. 하드웨어 디자인은 iROM code integrity를 증명한다. 다시 말해 first boot
loader, the second boot loader and OS images는 외부 메모리 디바이스에 저장된다. 그러므로 iROM code는 1st boot loader의 integrity를 verify해야만 하고, 1st boot loader에서 integrity check가 pass되면, 1st boot loader는 trust region에 포함된다. 다음에 1st boot loader는 2nd boot loader의 integrity를 check하고, 2nd boot loader는  OS image의 integrity를 verify 한다.

secure booting sequence는 다음과 같다.

iROM code는

1. Checks the integrity of RSA public key using E-fuse RSA key hash value.

2. Loads the first boot loader to iRAM.

3. Checks the integrity of first boot loader using trusted RSA public key.


first boot loader는

1. Loads security software to iRAM.

2. Checks the integrity of software using trusted RSA public key.

3. Loads second boot loader to iRAM.

4. Checks the integrity of second boot loader using trusted RSA public key.


second boot loader는

1. Loads security software to iRAM.

2. Checks the integrity of software using trusted RSA public key.

3. Loads OS kernel and applications to DRAM.

4. Checks the integrity of OS kernel and application using trusted RSA public key











Posted by eoseontaek