Skip to content

Commit c06efdb

Browse files
committed
make buildroot a submodule
1 parent 27b96eb commit c06efdb

File tree

2 files changed

+8
-32
lines changed

2 files changed

+8
-32
lines changed

Diff for: .gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "buildroot"]
2+
path = buildroot
3+
url = https://github.com/themactep/buildroot

Diff for: Makefile

+5-32
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Thingino Firmware
22
# https://github.com/themactep/thingino-firmware
33

4-
BUILDROOT_VERSION := git
5-
64
# Camera IP address
75
CAMERA_IP_ADDRESS ?= 192.168.1.10
86

@@ -25,16 +23,12 @@ OUTPUT_DIR ?= $(HOME)/output/$(BOARD)
2523
STDOUT_LOG ?= $(OUTPUT_DIR)/compilation.log
2624
STDERR_LOG ?= $(OUTPUT_DIR)/compilation-errors.log
2725

28-
BUILDROOT_BUNDLE := $(SRC_DIR)/buildroot-$(BUILDROOT_VERSION).tar.gz
29-
BUILDROOT_REPO := https://github.com/themactep/buildroot.git
30-
BUILDROOT_DIR := $(SRC_DIR)/buildroot-$(BUILDROOT_VERSION)-themactep
31-
3226
# project directories
3327
BR2_EXTERNAL := $(CURDIR)
3428
SCRIPTS_DIR := $(CURDIR)/scripts
3529

3630
# make command for buildroot
37-
BR2_MAKE = $(MAKE) -C $(BUILDROOT_DIR) BR2_EXTERNAL=$(BR2_EXTERNAL) O=$(OUTPUT_DIR)
31+
BR2_MAKE = $(MAKE) -C $(BR2_EXTERNAL)/buildroot BR2_EXTERNAL=$(BR2_EXTERNAL) O=$(OUTPUT_DIR)
3832

3933
BOARDS = $(shell find ./configs/*_defconfig | grep -v "\(_generic\|toolchain_\)" | sort | sed -E "s/^\.\/configs\/(.*)_defconfig/'\1' '\1'/")
4034

@@ -174,9 +168,9 @@ ROOTFS_OFFSET = $(shell echo $$(($(KERNEL_OFFSET) + $(KERNEL_SIZE_ALIGNED) )))
174168
FIRMWARE_BIN_FULL_SIZE = $(shell stat -c%s $(FIRMWARE_BIN_FULL))
175169
FIRMWARE_BIN_NOBOOT_SIZE = $(shell stat -c%s $(FIRMWARE_BIN_NOBOOT))
176170

177-
.PHONY: all toolchain sdk bootstrap clean defconfig distclean help info pack pack_full pack_update pad pad_full pad_update update_buildroot upload_tftp upload_sdcard upgrade_ota br-%
171+
.PHONY: all toolchain sdk bootstrap clean defconfig distclean help info pack pack_full pack_update pad pad_full pad_update upload_tftp upload_sdcard upgrade_ota br-%
178172

179-
all: update_buildroot defconfig
173+
all: defconfig
180174
ifndef BOARD
181175
$(MAKE) BOARD=$(BOARD) $@
182176
endif
@@ -208,7 +202,7 @@ endif
208202
clean: defconfig
209203
@rm -rf $(OUTPUT_DIR)/target $(OUTPUT_DIR)/.config
210204

211-
defconfig: $(BUILDROOT_DIR)
205+
defconfig:
212206
@rm -rvf $(OUTPUT_DIR)/.config
213207
$(BR2_MAKE) BR2_DEFCONFIG=$(BOARD_CONFIG) defconfig
214208

@@ -260,7 +254,7 @@ rebuild-%:
260254
$(BR2_MAKE) $(subst rebuild-,,$@)-dirclean
261255
$(BR2_MAKE) $(subst rebuild-,,$@)
262256

263-
sdk: update_buildroot defconfig
257+
sdk: defconfig
264258
ifeq ($(GCC),12)
265259
sed -i 's/^BR2_TOOLCHAIN_EXTERNAL_GCC_13=y/# BR2_TOOLCHAIN_EXTERNAL_GCC_13 is not set/' $(OUTPUT_DIR)/.config; \
266260
sed -i 's/^# BR2_TOOLCHAIN_EXTERNAL_GCC_12 is not set/BR2_TOOLCHAIN_EXTERNAL_GCC_12=y/' $(OUTPUT_DIR)/.config; \
@@ -269,11 +263,6 @@ ifeq ($(GCC),12)
269263
endif
270264
$(BR2_MAKE) sdk
271265

272-
update_buildroot: $(SRC_DIR)
273-
@if [ ! -d "$(SRC_DIR)" ]; then mkdir -p "$(SRC_DIR)"; fi
274-
@if [ ! -d "$(BUILDROOT_DIR)" ]; then git clone --depth 1 $(BUILDROOT_REPO) $(BUILDROOT_DIR); fi
275-
@cd $(BUILDROOT_DIR) && git pull && echo "Buildroot updated"
276-
277266
update_ota: pack_update
278267
scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -O $(FIRMWARE_BIN_NOBOOT) root@$(CAMERA_IP_ADDRESS):/tmp/fwupdate.bin
279268
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@$(CAMERA_IP_ADDRESS) "flashcp -v /tmp/fwupdate.bin /dev/mtd5 && reboot"
@@ -301,18 +290,6 @@ $(OUTPUT_DIR):
301290
$(SRC_DIR):
302291
mkdir -p $(SRC_DIR)
303292

304-
# download Buildroot bundle
305-
$(BUILDROOT_BUNDLE):
306-
$(WGET) -O $@ https://github.com/buildroot/buildroot/archive/refs/tags/$(BUILDROOT_VERSION).tar.gz
307-
#https://github.com/buildroot/buildroot/archive/refs/heads/master.zip
308-
309-
# install Buildroot sources from bundle
310-
$(BUILDROOT_DIR)/.extracted: $(BUILDROOT_BUNDLE)
311-
ls -l $(dirname $@)
312-
mkdir -p $(SRC_DIR)
313-
tar -C $(SRC_DIR) -xf $(BUILDROOT_BUNDLE)
314-
touch $@
315-
316293
# download bootloader
317294
$(U_BOOT_BIN):
318295
$(info U_BOOT_BIN: $@)
@@ -359,9 +336,6 @@ info: defconfig
359336
$(info BR2_EXTERNAL: $(BR2_EXTERNAL))
360337
$(info BR2_MAKE: $(BR2_MAKE))
361338
$(info BR2_SENSOR_MODEL: $(BR2_SENSOR_MODEL))
362-
$(info BUILDROOT_BUNDLE: $(BUILDROOT_BUNDLE))
363-
$(info BUILDROOT_DIR: $(BUILDROOT_DIR))
364-
$(info BUILDROOT_VERSION: $(BUILDROOT_VERSION))
365339
$(info CAMERA_IP_ADDRESS: $(CAMERA_IP_ADDRESS))
366340
$(info CURDIR: $(CURDIR))
367341
$(info SOC_FAMILY: $(SOC_FAMILY))
@@ -389,7 +363,6 @@ help:
389363
- make pad_update - pad the update firmware file with zeroes to 16MB\n\
390364
- make clean - cleaning before reassembly\n\
391365
- make distclean - switching to the factory state\n\
392-
- make prepare - download and unpack buildroot\n\
393366
- make info - write to stdout information about selected board\n\
394367
- make upgrade_ota CAMERA_IP_ADDRESS=192.168.1.10\n\
395368
- upload the full firmware file to the camera over network, and flash it\n\

0 commit comments

Comments
 (0)