Skip to content

Commit

Permalink
Added makefile rule for creating release versions and variable for ar…
Browse files Browse the repository at this point in the history
…mstub name
  • Loading branch information
thanoskoutr committed Apr 25, 2021
1 parent e0847b2 commit 503a4b8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ build
*.elf
*.bin

# Release stuff (Compressed)
*.gz
*.zip

# VS Code configs
.vscode/

Expand Down
25 changes: 22 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ ARMGNU_64 = aarch64-none-elf
IMG_NAME = kernel7
IMG_NAME_64 = kernel8

# Set armstub name
ARMSTUB_NAME = armstub-new

# Set Raspi Model, if not set
# RASPI_MODEL ?= 0
RASPI_MODEL ?= 4
Expand Down Expand Up @@ -58,7 +61,7 @@ COMMON_SRC = src/common

KERNEL_VERSION = 0.1.0

.PHONY: clean all build docs docs_pdf clean_docs
.PHONY: clean all build docs docs_pdf clean_docs release release_armstub

all: build

Expand Down Expand Up @@ -107,8 +110,24 @@ $(STUB_DIR)/$(BUILD_DIR)/%_s.o: $(STUB_FILES)
$(ARMGNU)-gcc $(SFLAGS) $(CFLAGS) -c $< -o $@

armstub: $(OBJ_STUB_FILES)
@echo "----- Building armstub -----"
$(ARMGNU)-ld --section-start=.text=0 -o ${STUB_DIR}/$(BUILD_DIR)/armstub.elf $<
$(ARMGNU)-objcopy ${STUB_DIR}/$(BUILD_DIR)/armstub.elf -O binary armstub-new.bin
$(ARMGNU)-objcopy ${STUB_DIR}/$(BUILD_DIR)/armstub.elf -O binary $(ARMSTUB_NAME).bin


# Release project
## Create compressed binaries for version releasing
release: build
@echo "----- Releasing for Raspberry Pi $(value RASPI_MODEL) -----"
@echo "----- Releasing for $(value AARCH) -----"
tar -czvf $(IMG_NAME)-v$(KERNEL_VERSION).tar.gz $(IMG_NAME).img
zip $(IMG_NAME)-v$(KERNEL_VERSION).zip $(IMG_NAME).img

## Create compressed binary for armstub
release_armstub: armstub
@echo "----- Releasing armstub -----"
tar -czvf $(ARMSTUB_NAME)-v$(KERNEL_VERSION).tar.gz $(ARMSTUB_NAME).bin
zip $(ARMSTUB_NAME)-v$(KERNEL_VERSION).zip $(ARMSTUB_NAME).bin


# Generating Documentation
Expand All @@ -134,7 +153,7 @@ docs_pdf:

# Clean rules
clean:
rm -rf $(BUILD_DIR) *.img *.elf *.bin $(STUB_DIR)/$(BUILD_DIR)
rm -rf $(BUILD_DIR) *.img *.elf *.bin *.gz *.zip $(STUB_DIR)/$(BUILD_DIR)

clean_docs:
rm -rf $(DOXYGEN_DIR)

0 comments on commit 503a4b8

Please sign in to comment.