bootloader

Calculating padding length with GAS AT&T directives for a boot sector?

♀尐吖头ヾ 提交于 2019-11-28 02:03:36
So I want to add padding in the bootsector. Let's say, there is currently just an endless loop in there: jmp . . The sector needs to be 512 bytes long. Also, the magic num 0xaa55 is needed which is added at the end. jmp . .skip 508, 0 .word 0xaa55 But what if I want to print something but don't want to count all the bytes to pad it into the right size? In Intel/NASM syntax would it be: ; print something times 510-($-$$) db 0 dw 0xaa55 But in AT&T syntax? Well a loop ( .rept ) doesn't work here because . doesn't give an absolute value which is needed here. We have the same problem with .skip /

Legacy BIOS bootloader to bootstrap real-mode code in second stage

梦想的初衷 提交于 2019-11-27 22:56:30
I am working on writing my own operating system. So far, my code exceeds 512 bytes, which is too large to fit in a simple boot sector. I understand that I now have to write a bootloader that reads arbitrary code that may or may not be greater than a single 512-byte sector. The bootloader would need to: Function as a boot record with disk signature 0xaa55. Read a second stage (the test code) start from LBA 1 (LBA 0 is boot sector) of arbitrary length starting at memory address 0x7E00. Transfer control to it using a FAR JMP to 0x0000:0x7E00. Be usable as a 1.44 MiB floppy disk image for use in

x86 NASM 'org' directive meaning

∥☆過路亽.° 提交于 2019-11-27 21:44:16
问题 I am following this tutorial as a first foray into bootloader/OS development for x86 using NASM: http://joelgompert.com/OS/TableOfContents.htm And I'm on Lesson 4, which is making my bootloader print the "Hello, world" string. I'm not understanding the meaning of the org instruction (directive?). As I understand it, org defines where the program being executed is loaded into memory. This is needed when using any sort of labels or relative addresses in the program. Suppose I have a string

Bootloader for Cortex M3

瘦欲@ 提交于 2019-11-27 16:15:36
问题 I am using a LPC 1768 board from mbed, (with cortex M3 cpu) and I am trying to achieve something here, mainly upgrade the user application from the SD Card, I am writing two programs, first a bootloader/nano-kernel, and a user-app (helloworld will do for a start): Bootloader/nano-kernel at 0x00 address runs, it will do some checks and eventually grab the binary file on the SD card Bootloader/nano-kernel will copy this binary at address 0x9000 (that might have to change later on, but this

int 13h 42h doesn't load anything in Bochs

末鹿安然 提交于 2019-11-27 14:54:41
I changed my bootloader from CHS to LBA, so I replaced int 13h 02h with int 13h 42h . It works correctly in QEMU, however, I have troubles running it with Bochs and my laptop. I wrote bootloader to USB flash drive with dd if=main.bin of=/dev/sdb bs=512 . Laptop loads Intel UNDI and gives me the following error: No bootable device - insert boot disk and press any key . So I tried to debug it with Bochs and noticed that Bochs recognizes this binary file as bootable. However, nothing had been loaded after int 13h executed. Then I tried to load my old PC from this flash drive, and it works! It

第八周作业

半腔热情 提交于 2019-11-27 12:32:12
1、用shell脚本实现自动登录机器 #!/usr/bin/expect set ip 192.168.2.192 set user root set password root spawn ssh $user@$ip expect { "yes/no" { send "yes\n";exp_cotinue} "password" {send "$password\n"} } interact 2、shell 判断一个值bone是否在数组arrayZ=( one two three four five five )中 #!/bin/bash var=( "one" "two" "three" "four" "five" "five" ) for i in seq $[${#var[*]}-1] ;do echo ${var[$i]} if [ ${var[$i]} == bond ];then echo yes else echo no fi done unset var 3、用命令或者脚本实现 0057AF051EFF 变为 00:57:AF:05:1E:FF a=0057AF051EFF echo ${a:0:2}:${a:2:2}:${a:4:2}:${a:6:2}:${a:8:2}:${a:10:2} 4、a b c d e f g h i j k l m n o p q

Printing a string without OS

落爺英雄遲暮 提交于 2019-11-27 08:06:35
问题 I have a simple program in x86 assembly language. It should print a string directly to the video memory without OS. [bits 16] [org 0x7c00] mov ax, 0x3 int 0x10 sdl mov ax, 0xb800 mov es,ax mov si, msg xor di, di repnz movsw jmp $ msg db 'Hello' times 510 - ($ - $$) db 0 dw 0xaa55 But it doesn't work. Can you help me? 回答1: There are some issues: There is no such instruction as sdl . To copy data, you should use rep movsw , not repnz movsw . You need to set cx before rep movsw . You need to

Why do we need a bootloader in an embedded device?

本秂侑毒 提交于 2019-11-27 05:18:36
问题 I'm working with ELinux kernel on ARM cortex-A8. I know how the bootloader works and what job it's doing. But i've got a question - why do we need bootloader, why was the bootloader born ? Why we can't directly load the kernel into RAM from flash memory without bootloader? If we load it what will happen? In fact, processor will not support it, but why are we following the procedure? 回答1: A boot loader is a computer program that loads the main operating system or runtime environment for the

Constant reboot after setting up the Global Descriptor Table and protected mode

我只是一个虾纸丫 提交于 2019-11-27 04:52:34
问题 I must have done something wrong with the GDT setup and the switch to protected mode because it keeps constantly rebooting. Here is my kernel.asm that should setup the GDT and switch to protected mode : bits 16 jmp main %include "gdt.inc" main: cli xor ax,ax mov ds,ax mov es,ax mov ax,0x9000 mov ss,ax mov sp,0xffff sti call InstallGDT cli mov eax,cr0 or eax,1 jmp 08h:Stage3 bits 32 Stage3: mov ax,0x10 mov ds,ax mov ss,ax mov es,ax mov esp,90000h Stop: mov byte [0xb8000],'A' cli hlt and there

How can i put a compiled boot sector onto a USB stick or disk?

◇◆丶佛笑我妖孽 提交于 2019-11-27 02:25:54
问题 I'm actually interested in how an OS works, from the POST over the Boot process to the Kernel, GUI, etc. Well I have to start at the beginning: The bootsector Most tutorials only specify how to get your .bin bootstrapper onto an USB stick for Linux users. But as I'm using XP I would like to ask how do I get my 512 byte .bin onto the right position on my USB , and thats definitely not by copying it with explorer :D 回答1: There's dd for Windows which I use regularly. http://www.chrysocome.net/dd