forked from elastx/elx-pba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage.mk
40 lines (36 loc) · 1.38 KB
/
image.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
ifeq ($(ARCH),x86_64)
BOOTXEFI := bootx64.efi
endif
.build/elx-pba-$(ARCH).fs: $(KERNEL_IMAGE)
truncate -s 30M "$@"
mkfs.vfat -n ELX-PBA "$@"
mmd -oi "$@" ::EFI
mmd -oi "$@" ::EFI/BOOT
mcopy -oi "$@" $< ::EFI/BOOT/$(BOOTXEFI)
mdir -/i "$@" ::
.build/elx-pba-$(ARCH).img: .build/elx-pba-$(ARCH).fs
truncate -s 32M "$@"
sgdisk -og "$@"
sgdisk -n "1:2048:" -c 1:"EFI System Partition" -t 1:ef00 "$@"
dd if="$<" of="$@" seek=2048 bs=512 conv=notrunc
# Mark the image in the MBR region which we are not using anyway in EFI mode
echo -n "ELX PBA IMAGE git $(shell git rev-parse --short=12 HEAD)" | \
dd if=/dev/stdin of="$@" count=1 bs=448 conv=notrunc
sfdisk -l "$@"
.build/elx-rescue-$(ARCH).fs: $(KERNEL_IMAGE) .build/elx-pba-$(ARCH).img
truncate -s 60M "$@"
mkfs.vfat -n ELX-RESCUE "$@"
mmd -oi "$@" ::EFI
mmd -oi "$@" ::EFI/BOOT
mcopy -oi "$@" $< ::EFI/BOOT/$(BOOTXEFI)
mcopy -oi "$@" .build/elx-pba-$(ARCH).img ::elx-pba-$(ARCH).img
mdir -/i "$@" ::
.build/elx-rescue-$(ARCH).img: .build/elx-rescue-$(ARCH).fs
truncate -s 62M "$@"
sgdisk -og "$@"
sgdisk -n "1:2048:" -c 1:"EFI System Partition" -t 1:ef00 "$@"
dd if="$<" of="$@" seek=2048 bs=512 conv=notrunc
# Mark the image in the MBR region which we are not using anyway in EFI mode
echo -n "ELX RESCUE git $(shell git rev-parse --short=12 HEAD)" | \
dd if=/dev/stdin of="$@" count=1 bs=448 conv=notrunc
sfdisk -l "$@"