edit makefile for copying image and config to sd card

This commit is contained in:
Nelson Ehling 2024-03-27 12:57:39 +01:00
parent c71a1cc18a
commit 0bd322d7b7
4 changed files with 65 additions and 27 deletions

View file

@ -1,20 +1,25 @@
BOOTMNT ?= /media/cvdeveloper/bootfs
CFILES = $(wildcard *.c lib/*.c kernel/*.c net/*.c tcpip/*.c) CFILES = $(wildcard *.c lib/*.c kernel/*.c net/*.c tcpip/*.c)
SFILES = $(wildcard boot/*.S lib/*.S kernel/*.S) SFILES = $(wildcard boot/*.S lib/*.S kernel/*.S)
OFILES = $(CFILES:.c=.o) $(SFILES:.S=.o) OFILES = $(CFILES:.c=.o) $(SFILES:.S=.o)
LLVMPATH = /opt/homebrew/opt/llvm/bin GCCFLAGS = -Wall -O0 -ffreestanding -nostdlib -nostartfiles
CLANGFLAGS = -Wall -O0 -ffreestanding -nostdlib -mcpu=cortex-a72+nosimd GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin
all: clean kernel8.img all: clean kernel8.img
%.o: %.c %.o: %.c
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@ $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@
%.o: %.S %.o: %.S
$(LLVMPATH)/clang --target=aarch64-elf $(CLANGFLAGS) -c $< -o $@ $(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@
kernel8.img: $(OFILES) kernel8.img: $(OFILES)
$(LLVMPATH)/ld.lld -m aarch64elf -nostdlib $(OFILES) -T boot/link.ld -o kernel8.elf $(GCCPATH)/aarch64-none-elf-ld -nostdlib $(OFILES) -T boot/link.ld -o kernel8.elf
$(LLVMPATH)/llvm-objcopy -O binary kernel8.elf kernel8.img $(GCCPATH)/aarch64-none-elf-objcopy -O binary kernel8.elf kernel8.img
cp kernel8.img $(BOOTMNT)/kernel8.img
cp config.txt $(BOOTMNT)/
sync
clean: clean:
/bin/rm kernel8.elf */*.o *.img > /dev/null 2> /dev/null || true /bin/rm kernel8.elf */*.o *.img > /dev/null 2> /dev/null || true

View file

@ -1,20 +0,0 @@
CFILES = $(wildcard *.c lib/*.c kernel/*.c net/*.c tcpip/*.c)
SFILES = $(wildcard boot/*.S lib/*.S kernel/*.S)
OFILES = $(CFILES:.c=.o) $(SFILES:.S=.o)
GCCFLAGS = -Wall -O0 -ffreestanding -nostdlib -nostartfiles
GCCPATH = ../../gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin
all: clean kernel8.img
%.o: %.c
$(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@
%.o: %.S
$(GCCPATH)/aarch64-none-elf-gcc $(GCCFLAGS) -c $< -o $@
kernel8.img: $(OFILES)
$(GCCPATH)/aarch64-none-elf-ld -nostdlib $(OFILES) -T boot/link.ld -o kernel8.elf
$(GCCPATH)/aarch64-none-elf-objcopy -O binary kernel8.elf kernel8.img
clean:
/bin/rm kernel8.elf */*.o *.img > /dev/null 2> /dev/null || true

View file

@ -0,0 +1,53 @@
# For more options and information see
# http://rptl.io/configtxt
# Some settings may impact device functionality. See link above for details
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
# Additional overlays and parameters are documented
# /boot/firmware/overlays/README
# Automatically load overlays for detected cameras
camera_auto_detect=1
# Automatically load overlays for detected DSI displays
display_auto_detect=1
# Automatically load initramfs files, if found
auto_initramfs=1
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2
# Don't have the firmware create an initial video= setting in cmdline.txt.
# Use the kernel's default instead.
disable_fw_kms_setup=1
# Run in 64-bit mode
arm_64bit=1
# Disable compensation for displays with overscan
disable_overscan=1
# Run as fast as firmware / board allows
arm_boost=1
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[all]
kernel_old=1
disable_commandline_tags=1
core_freq_min=500
hdmi_group=1
hdmi_mode=16

View file

@ -59,7 +59,7 @@ ENC_HandleTypeDef handle;
unsigned char myMAC[6] = { 0xc0, 0xff, 0xee, 0xc0, 0xff, 0xee }; unsigned char myMAC[6] = { 0xc0, 0xff, 0xee, 0xc0, 0xff, 0xee };
// IP address to be assigned to the ENC28J60 // IP address to be assigned to the ENC28J60
unsigned char deviceIP[4] = { 192, 168, 0, 66 }; unsigned char deviceIP[4] = { 10, 7, 3, 20 };
void init_network(void) void init_network(void)
{ {