Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Kruhlmann/re-bootloader
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.0.0
Choose a base ref
...
head repository: Kruhlmann/re-bootloader
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 9 commits
  • 5 files changed
  • 1 contributor

Commits on Jul 15, 2024

  1. Add demo

    Kruhlmann committed Jul 15, 2024
    Copy the full SHA
    142f58d View commit details
  2. Update README.md

    Kruhlmann authored Jul 15, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    92b7fb6 View commit details
  3. Reduce image size

    Kruhlmann committed Jul 15, 2024
    Copy the full SHA
    f00185b View commit details
  4. Update changelog

    Kruhlmann committed Jul 15, 2024
    Copy the full SHA
    8768cc5 View commit details

Commits on Jul 16, 2024

  1. Fix typo in changelog

    Kruhlmann committed Jul 16, 2024
    Copy the full SHA
    e49b5c7 View commit details
  2. Make docs ajour

    Kruhlmann committed Jul 16, 2024
    Copy the full SHA
    db39595 View commit details
  3. Update changelog

    Kruhlmann committed Jul 16, 2024
    Copy the full SHA
    ae42400 View commit details
  4. Update changelog

    Kruhlmann committed Jul 16, 2024
    Copy the full SHA
    ae24825 View commit details

Commits on Aug 13, 2024

  1. Add missing phony marker

    Kruhlmann committed Aug 13, 2024
    Copy the full SHA
    d1e3778 View commit details
Showing with 23 additions and 6 deletions.
  1. +1 −0 .gitattributes
  2. +8 −1 CHANGELOG.md
  3. +7 −3 Makefile
  4. +4 −2 README.md
  5. +3 −0 doc/demo.gif
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
doc/demo.gif filter=lfs diff=lfs merge=lfs -text
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,12 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.1]

### Changed

- Reduced image size by 90%

## [1.0.0]

### Added

- Working UEFI bootloader
- Functional documentation

[unreleased]: https://github.com/Kruhlmann/re-bootloader/compare/1.0.0...HEAD
[unreleased]: https://github.com/Kruhlmann/re-bootloader/compare/1.0.1...HEAD
[1.0.1]: https://github.com/Kruhlmann/re-bootloader/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/Kruhlmann/re-bootloader/releases/tag/1.0.0]
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -6,14 +6,13 @@ LD_OBJ ?= /usr/lib/crt0-efi-x86_64.o
EFI_LDS ?= /usr/lib/elf_x86_64_efi.lds
BIOS_FD ?= /usr/share/OVMF/FV/OVMF.fd
LD_EXTRA ?=
DISK_BLOCK_COUNT ?= 204800
DISK_BLOCK_SIZE_BYTES ?= 512

CC := gcc
CFLAGS := -c -fno-stack-protector -fpic -fshort-wchar -mno-red-zone -DEFI_FUNCTION_WRAPPER $(addprefix -I,$(INCLUDE_DIRS))
LDFLAGS := $(LD_OBJ) -nostdlib -znocombreloc -T $(EFI_LDS) -shared -Bsymbolic -lgnuefi -lefi $(LD_EXTRA)
QEMUFLAGS := -bios $(BIOS_FD) -nographic -serial mon:stdio
OBJCOPYFLAGS := -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .reloc --target=efi-app-x86_64
DISK_BLOCK_SIZE_BYTES := 512

.PHONY: all
all: main.efi
@@ -23,6 +22,11 @@ run: reboot.img
qemu-system-x86_64 -drive file=$<,format=raw $(QEMUFLAGS)

reboot.img: main.efi
$(eval EFI_SIZE := $(shell stat -c%s $<))
$(eval MIN_DISK_SIZE := 10485760) # Minimum disk size of 10MB
$(eval DISK_SIZE := $(shell echo $$(( $(EFI_SIZE) + 1048576 ))))
$(eval FINAL_DISK_SIZE := $(shell echo $$(( $(DISK_SIZE) > $(MIN_DISK_SIZE) ? $(DISK_SIZE) : $(MIN_DISK_SIZE) ))))
$(eval DISK_BLOCK_COUNT := $(shell echo $$(( ($(FINAL_DISK_SIZE) + $(DISK_BLOCK_SIZE_BYTES) - 1) / $(DISK_BLOCK_SIZE_BYTES) ))))
dd if=/dev/zero of=$@ bs=$(DISK_BLOCK_SIZE_BYTES) count=$(DISK_BLOCK_COUNT)
parted -s $@ mklabel gpt
parted -s $@ mkpart EFI fat32 2048s 100%
@@ -42,6 +46,6 @@ reboot.img: main.efi
%.so: %.o
ld $< $(LDFLAGS) -o $@

.PHONY:
.PHONY: clean
clean:
rm *.o *.so *.efi reboot.img
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,10 @@ This project implements a simple AMD64 UEFI bootloader that immediately reboots

Useful as a fall-back disk install in case machines that rely on PXE cannot be configured to auto-retry.

<p align="center">
<img src="./doc/demo.gif" width="60%" />
</p>

## Dependencies

This project requires the following tools and libraries:
@@ -60,8 +64,6 @@ The Makefile supports several variables that can be overridden:
- `LD_OBJ`: Path to the UEFI crt0 object file (default: `/usr/lib/crt0-efi-x86_64.o`)
- `EFI_LDS`: Path to the UEFI linker script (default: `/usr/lib/elf_x86_64_efi.lds`)
- `BIOS_FD`: Path to the OVMF BIOS image for QEMU (default: `/usr/share/OVMF/FV/OVMF.fd`)
- `DISK_BLOCK_COUNT`: Number of blocks in the disk image (default: 204800)
- `DISK_BLOCK_SIZE_BYTES`: Size of each block in bytes (default: 512)

Example usage:

3 changes: 3 additions & 0 deletions doc/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.