Defining CPU Variant in Config?

I'm just getting my feet wet with OpenWrt, so forgive the base questions I'm sure I'll be asking.

CPU is a Cavium Octeon III

I've added the patches to the kernel source for the network drivers I need, and I've seen throughout the code that a LOT of defines had already been made in the existing code.

I need to define a CPU Variant as OCTEON_CN70XX_PASS1_2 and I'm not sure where to actually do that at. I've looked at the existing Octeon devices and they don't outline anything but the phys_map for MTD in the Ubiquity devices (which I don't seem to need).

I added the device to the menu config, but of course it just uses the Default/Generic defines. (target/linux/octeon/image/Makefile). Should I be using TARGET_DEVICE += for this define?

Part of the puzzle might be that all boards for a given target/subtarget use the same kernel. If you need differences, you may need to declare a subtarget. See, for example ath79 generic/tiny.

1 Like

I guess it boils down to how much you need to patch the octeon target "directory" to get it working, I would however imagine that Octeon+ isn't ideal for Octeon III so you probably need to split it into subtargets which I personally find a bit messy.

1 Like

So far, the only difference that I've needed to add patches for was the network driver. Everything else seems to be working. I posed the question because when I was digging through the patches and the source (I had to make a change to make a define change to make the patches work) I noticed the ifdefs for the CPU types.

The code seems to have support for the Octeon III (the patches were released in 2014), I'm just not sure how to set the def.

CPU0 revision is: 000d9602 (Cavium Octeon III)

That is in the boot log, and the documentation shows calls for setting the 000d9602, but the existing files don't follow that format for the defines in the Makefile.

#
# Copyright (C) 2009-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk

define Device/Default
  PROFILES = Default $$(DEVICE_NAME)
  KERNEL_NAME := vmlinux.elf
  KERNEL_INITRAMFS_NAME := vmlinux-initramfs.elf
  KERNEL := kernel-bin | strip-kernel | patch-cmdline
  IMAGES := sysupgrade.tar
  IMAGE/sysupgrade.tar/squashfs := append-rootfs | pad-extra 128k | sysupgrade-tar rootfs=$$$$@
  IMAGE/sysupgrade.tar := sysupgrade-tar
endef

define Build/strip-kernel
	# Workaround pre-SDK-1.9.0 u-boot versions not handling the .notes section
	$(TARGET_CROSS)strip -R .notes $@ -o $@.stripped && mv $@.stripped $@
endef

define Device/generic
  FILESYSTEMS := ext4
  DEVICE_TITLE := Generic
endef
TARGET_DEVICES += generic

ER_CMDLINE:=-mtdparts=phys_mapped_flash:640k(boot0)ro,640k(boot1)ro,64k(eeprom)ro root=/dev/mmcblk0p2 rootfstype=squashfs,ext4 rootwait
define Device/er
  CMDLINE := $(ER_CMDLINE)
  DEVICE_TITLE := Ubiquiti EdgeRouter
endef
TARGET_DEVICES += er

ERLITE_CMDLINE:=-mtdparts=phys_mapped_flash:512k(boot0)ro,512k(boot1)ro,64k(eeprom)ro root=/dev/sda2 rootfstype=squashfs,ext4 rootwait
define Device/erlite
  CMDLINE := $(ERLITE_CMDLINE) 
  DEVICE_TITLE := Ubiquiti EdgeRouter Lite
endef
TARGET_DEVICES += erlite

define Device/itus
  DEVICE_TITLE := Itus Networks Shield
endef
TARGET_DEVICES += itus

$(eval $(call BuildImage))

Of course, I just put the itus branch in there without changing any of the defaults for now.

I wonder if I'm not just overthinking this whole thing. When I use the Octeon/Generic, it correctly ID's the CPU in the boot log, so maybe nothing else needs to be done to the source except for the BGX network patches..

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.