bootloader

How does the bootloader pick up the command after a “restarting system with command”?

喜你入骨 提交于 2019-12-03 16:49:46
问题 Looking in the android source for the reboot command we find the following line: __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, \ LINUX_REBOOT_CMD_RESTART2, argv[optind]); Which is the standard Linux system call to reboot the system with a specific command, see Unix System Call Reboot. In Android this command is used to tell the bootloader to start either the kernel in recovery mode or to go to the fastboot mode within the bootloader. My question is: How does the bootloader pick up the

Android 刷机方案

梦想的初衷 提交于 2019-12-03 15:27:34
## 获取 在刷机之前,需要在电脑上下载 **Android Preview** 包,一般我都是到 [安卓中国](https://developer.android.google.cn/preview/download#flash) ,这里可以下载最新的包。 ## 手机 相对下载包的获取,比较难的是有一部支持最新的安卓系统的手机,一般 **Preview** 版的系统都是默认支持 **Google** 自己的手机的。 主要有面向的是 Pixel 系列的手机。Google 还是对自己的 **亲儿子** 系列更喜欢。 ## 刷机 刷机目前有两个比较麻烦的地方,第一就是需要安装 `adb` 的命令,也就是 **Android** 的功能模块,第二就是需要解锁手机。 ### adb 配置 即将 **Android SDK** 下载下来,然后将其配置到环境变量中即可 #### Windows 1. 配置 **ANDROID\_HOME** 变量到环境变量中 2. 配置 **%ANDROID\_HOME%\platform-tools** 到 **path** 中 3. 配置 **%ANDROID\_HOME%\tools** 到 **path** 中 #### Linux & Mac 打开 **profile** 文件,默认为 _.bash\_profile_ 如果使用的是 **zsh**

Read a write a sector from hard drive with int 13h

纵饮孤独 提交于 2019-12-03 14:30:09
问题 I have a simple program. It must read first sector from hard drive (not mbr), and write it to the 0 sector (mbr). But it doesnt work. I think it is connected with wrong DAP. Thanks. [bits 16] [org 0x7c00] ;clear screen start: mov ax, 0x3 int 0x10 ;reset the hard drive xor ah, ah mov dl, 0x80 int 0x13 jnz error ;read the second sector mov si, DAP mov ah, 0x42 int 0x13 mov si, data call print_string jmp $ DAP: db 0x10 ;size of DAP db 0x0 ;zero db 0x1 ;number of sectors to read db 0x0 ;zero

Disk Read Error while loading sectors into memory

北慕城南 提交于 2019-12-03 12:05:19
I tried to develop a bootloader using this , but when it is run it shows: disk read error! If I ignore it, in a later part, it shows me wrong memory mapping. I also followed some other sources too but in vain. It feels like I'm just copying what they are doing. If I do even a little different a new kind of error generates every time. Should I use an already built bootloader or what to do? The code of disk load error is as follow: [org 0x7c00] KERNEL_OFFSET equ 0x1000 mov [BOOT_DRIVE], dl mov bp, 0x9000 mov sp, bp mov bx, MSG_REAL_MODE call print_string call load_kernel jmp $ print_string:

What is significance of memory at 0000:7c00 to booting sequence?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 12:00:41
问题 Why does bios read at partition's boot record at 0000:7c00 ? What is special about that address ? what ':' doing in referencing an address ? 回答1: The ":" is a holdover from segmented memory days, when PCs ran in real mode and could only do 64K at a time. The number to the left of the ":" is your segment, the number to the right is your address. The windows debug command accepts this notation if you want to poke around in memory yourself: C:\Users\Seth> debug -d0000:7c00 0000:7C00 00 00 00 00

How to write on hard disk with bios interrupt 13h

烈酒焚心 提交于 2019-12-03 09:12:39
I want to copy my boot loader to first sector(512) of hard disk within itself (I should use bios interrupt 13h) and I found this code: mov bx, buffer1 ; set BX to the address (not the value) of BlahBlah mov ah,03h ;When ah=, int13 reads a disk sector mov al,5 ;Al is how many sectors to read mov cl,0 ;Sector Id mov dh,0 ;Head mov dl,80h ;Drive (0 is floppy) mov cx,512 ;One sector /2 mov ah, 0x3 ; set function 2h int 0x13 bu it does not work! Daniel Kamil Kozar Your code is very messy. In order to properly use int 13h with AH = 3 , you need to also set ES (the segment in which BX resides, e.g.

ARM Bootloader: Disable MMU and Caches

扶醉桌前 提交于 2019-12-03 08:51:50
问题 According to some tutorials, we will disable MMU and I/D-Caches at the beginning of bootlaoder. If I understand correctly, it aims to use the physical address directly in the program, so please correct me if I'm wrong. Thank you! Secondly, we do this to disable MMU and Caches: mrc P15, 0, R0, C1, C0, 0 bic R0, R0, #0x00002300 @ clear bits 13, 9:8 bic R0, R0, #0x00000087 @ clear bits 7, 2:0 orr R0, R0, #0x00000002 @ set bit 2 (A) Align orr R0, R0, #0x00001000 @ set bit 12 (I) I-Cache mcr P15,

Real Mode Assembly: Print Char to Screen without INT Instruction on Boot

被刻印的时光 ゝ 提交于 2019-12-03 08:22:44
The following site "Writing Boot Sector Code" provides a sample of code that prints 'A' to the screen when the system boots. From what I have been reading don't you have to use INT opcode to get BIOS to do certain things? How does the code below, from the site referenced above work without using interrupts? What portion of code actually tells the hardware to print 'A' to the screen? Code in question: .code16 .section .text .globl _start _start: mov $0xb800, %ax mov %ax, %ds movb $'A', 0 movb $0x1e, 1 idle: jmp idle APPENDING TO ORIGINAL QUESTION If I use the following code does the BIOS call

Compile an asm bootloader with external c code

余生颓废 提交于 2019-12-03 08:07:57
I write a boot loader in asm and want to add some compiled C code in my project. I created a test function here: test.c __asm__(".code16\n"); void print_str() { __asm__ __volatile__("mov $'A' , %al\n"); __asm__ __volatile__("mov $0x0e, %ah\n"); __asm__ __volatile__("int $0x10\n"); } And here is the asm code (the boot loader): hw.asm [org 0x7C00] [BITS 16] [extern print_str] ;nasm tip start: mov ax, 0 mov ds, ax mov es, ax mov ss, ax mov sp, 0x7C00 mov si, name call print_string mov al, ' ' int 10h mov si, version call print_string mov si, line_return call print_string call print_str ;call

Why 55 AA is used as the boot signature on IBM PCs? [closed]

此生再无相见时 提交于 2019-12-03 06:56:42
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. Why does the IBM PC architecture use 55 AA magic numbers in the last two bytes of a bootsector for the boot signature ? I suspect that has something to do with the bit patterns they are: 01010101 10101010 , but don't know what. My guesses are that: BIOS is making some bitwise and/or/xor operations on these bytes to compare them together and if it, for example, results in 0, it can easily detect that and jump somewhere.