Skip to content

Commit

Permalink
Accton AS9926_24D: add to support ONIE
Browse files Browse the repository at this point in the history
Signed-off-by: david_yang <[email protected]>
Signed-off-by: Michael Shych <[email protected]>
  • Loading branch information
david56 authored and mshych committed Jul 17, 2023
1 parent c518311 commit 0ed9e73
Show file tree
Hide file tree
Showing 12 changed files with 273 additions and 0 deletions.
1 change: 1 addition & 0 deletions build-config/scripts/onie-build-targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
{ "Vendor": "accton", "Platform": "accton_as9716_32d", "BuildEnv": "Debian10", "Release": "2023.05br", "Architecture": "amd64", "Notes": "No notes." },
{ "Vendor": "accton", "Platform": "accton_as7946_30xb", "BuildEnv": "Debian10", "Release": "2023.05br", "Architecture": "amd64", "Notes": "No notes." },
{ "Vendor": "accton", "Platform": "accton_as7946_74xkb", "BuildEnv": "Debian10", "Release": "2023.05br", "Architecture": "amd64", "Notes": "No notes." },
{ "Vendor": "accton", "Platform": "accton_as9926_24d", "BuildEnv": "Debian10", "Release": "2023.05br", "Architecture": "amd64", "Notes": "No notes." },
{ "Vendor": "accton", "Platform": "accton_as9926_24db", "BuildEnv": "Debian10", "Release": "2023.05br", "Architecture": "amd64", "Notes": "No notes." },
{ "Vendor": "accton", "Platform": "accton_as_28t_ops", "BuildEnv": "Debian9", "Release": "2021.08br", "Architecture": "armv7", "Notes": "No notes." },
{ "Vendor": "accton", "Platform": "accton_asgvolt64", "BuildEnv": "Debian10", "Release": "2023.05br", "Architecture": "amd64", "Notes": "No notes." },
Expand Down
110 changes: 110 additions & 0 deletions machine/accton/accton_as9926_24d/INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
====================================
Installing ONIE on Accton AS9926_24D
====================================

Cross-Compiling ONIE
====================

Change directories to ``build-config`` to compile ONIE.

To compile ONIE first change directories to ``build-config`` and then
type ``"make MACHINEROOT=../machine/accton MACHINE=accton_as9926_24d all"``.
For example::

$ cd build-config
$ make -j4 MACHINEROOT=../machine/accton MACHINE=accton_as9926_24d all

When complete, the ONIE binaries are located in
``build/images``::

-rw-rw-r-- 1 8217496 Sep 17 14:24 accton_as9926_24d-r0.initrd
-rw-rw-r-- 1 3445024 Sep 17 14:23 accton_as9926_24d-r0.vmlinuz
-rw-rw-r-- 1 25952256 Sep 17 14:25 onie-recovery-x86_64-accton_as9926_24d-r0.iso
-rw-rw-r-- 1 11695991 Sep 17 14:24 onie-updater-x86_64-accton_as9926_24d-r0

accton_as9926_24d-r0.vmlinuz -- This is the ONIE kernel image

accton_as9926_24d-r0.initrd -- This is the ONIE initramfs (filesystem)

onie-recovery-x86_64-accton_as9926_24d-r0.iso -- This is the ONIE recovery
ISO image. This image can be used to create a bootable USB memory stick
for installing/recovery ONIE.

onie-updater-x86_64-accton_as9926_24d-r0 -- This is the ONIE self-update
image. This image is a self-extracting archive used for installing ONIE.

Installing ONIE on a Blank Machine
==================================

To install ONIE on a new machine, you can use the recovery ISO image to
create a bootable USB memory stick.

Creating bootable USB stick
---------------------------

Use ``dd`` to copy the .iso image to a USB stick and boot from that::

dd if=<machine>.iso of=/dev/sdX bs=10M

You can find the correct ``/dev/sdX`` by inspecing the ``dmesg``
output after inserting the USB stick into your work station.

Booting from USB stick
----------------------

To enable booting from USB in the BIOS:

1. Insert the USB stick

2. Power on the switch and enter the BIOS configuration

3. Set the hard drive boot order:

In "Boot Option #1" select the device that corresponds to your
device::

Boot-->Boot Option Priorities-->Boot Option #1

If the device name is not listed in "Boot Option #1", please
check the priorities in the hard drive boot order::

Boot-->Hard Drive BBS Priorities-->Boot Option #1

Taking ``JetFlashTranscend 8GB 8.07`` as an example, the boot
order will look like following::

Boot Option Priorities
Boot Option #1 [JetFlashTranscend 8...]
Boot Option #2 [ATP ATP IG eUSB 1100]
Boot Option #3 [IBA GE Slot 00A0 v1543]
Boot Option #4 [UEFI: Built-in EFI ...]

4. Save and Exit the BIOS configuration

5. After several seconds, you should see:

GNU GRUB version 2.02~beta2+e4a1fe391

+----------------------------------------------------------------------------+
|*ONIE: Rescue |
| ONIE: Embed ONIE |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
+----------------------------------------------------------------------------+

Use the ^ and v keys to select which entry is highlighted.
Press enter to boot the selected OS, `e' to edit the commands
before booting or `c' for a command-line.

- Choose ``ONIE: Embed ONIE`` for creating a fresh partition layout and
installing ONIE automatically. All data on the mass storage will be
erased.
- Choose ``ONIE: Rescue`` for entering ONIE recovery command-line shell.
10 changes: 10 additions & 0 deletions machine/accton/accton_as9926_24d/busybox/conf/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CONFIG_SYS_EEPROM=y
CONFIG_SYS_EEPROM_DEVICE_I2C=y
CONFIG_SYS_EEPROM_I2C_DEVICE="/dev/i2c-0"
CONFIG_SYS_EEPROM_I2C_ADDR=0x55
CONFIG_SYS_EEPROM_I2C_MEM_ADDR_BITS=16
CONFIG_SYS_EEPROM_I2C_WRITE_2B_DELAY=4000
CONFIG_SYS_EEPROM_I2C_WRITE_3B_DELAY=4000
CONFIG_SYS_EEPROM_OFFSET=0
CONFIG_SYS_EEPROM_SIZE=256
CONFIG_SYS_EEPROM_MAX_SIZE=256
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
patches for platform

diff --git a/miscutils/24cXX.c b/miscutils/24cXX.c
index ccc0965..6a50511 100644
--- a/miscutils/24cXX.c
+++ b/miscutils/24cXX.c
@@ -92,6 +92,21 @@ int eeprom_open(char *dev_fqn, int addr, int type, struct eeprom* e)
CHECK_I2C_FUNC( funcs, I2C_FUNC_SMBUS_READ_WORD_DATA );
CHECK_I2C_FUNC( funcs, I2C_FUNC_SMBUS_WRITE_WORD_DATA );

+ if (addr == 0x55) {
+ if( ( r = ioctl(fd, I2C_SLAVE, 0x77)) < 0)
+ return r;
+ r = i2c_smbus_write_byte_data(fd, 0, 0x1);
+ if(r < 0)
+ fprintf(stderr, "Error: setting channel: %s\n", strerror(errno));
+ usleep(10);
+ if( ( r = ioctl(fd, I2C_SLAVE, 0x76)) < 0)
+ return r;
+ r = i2c_smbus_write_byte_data(fd, 0, 0x40);
+ if(r < 0)
+ fprintf(stderr, "Error: setting channel: %s\n", strerror(errno));
+ usleep(10);
+ }
+
// set working device
if( ( r = ioctl(fd, I2C_SLAVE, addr)) < 0)
return r;
1 change: 1 addition & 0 deletions machine/accton/accton_as9926_24d/busybox/patches/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
onie-syseeprom-i2c-mux.patch
1 change: 1 addition & 0 deletions machine/accton/accton_as9926_24d/demo/platform.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# as9926_24d specific info
31 changes: 31 additions & 0 deletions machine/accton/accton_as9926_24d/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Accton as9926_24d ONIE installer configuration

description="Accton, as9926_24d"

mass_dev="storage-not-found"
discover_mass_storage()
{
mass_bus="$1"
for i in a b c d e ; do
if $(ls -l /sys/block/sd$i/device 2>/dev/null | grep -q "$mass_bus") ; then
mass_dev="/dev/sd$i"
return 0
fi
done
return 1
}

# Default ONIE block device
install_device_platform()
{
discover_mass_storage "target0:0:0" ||
discover_mass_storage "target1:0:0"
ret=$?
echo "$mass_dev"
return $ret
}

# Local Variables:
# mode: shell-script
# eval: (sh-set-shell "/bin/sh" t nil)
# End:
7 changes: 7 additions & 0 deletions machine/accton/accton_as9926_24d/kernel/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CONFIG_IGB=y
CONFIG_I2C_I801=y
CONFIG_USB_XHCI_HCD=y
# CONFIG_USB_XHCI_PLATFORM is not set
# CONFIG_DCB is not set
CONFIG_IXGBE=y
CONFIG_IXGBE_HWMON=y
1 change: 1 addition & 0 deletions machine/accton/accton_as9926_24d/kernel/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
driver-ixgbe-phy.patch
44 changes: 44 additions & 0 deletions machine/accton/accton_as9926_24d/machine.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Accton AS9926_24D

# Vendor's version number can be defined here.
# Available variable is 'VENDOR_VERSION'.
# e.g.,
# VENDOR_VERSION = .00.01

ONIE_ARCH ?= x86_64
SWITCH_ASIC_VENDOR = bcm

VENDOR_REV ?= 0

# Translate hardware revision to ONIE hardware revision
ifeq ($(VENDOR_REV),0)
MACHINE_REV = 0
else
$(warning Unknown VENDOR_REV '$(VENDOR_REV)' for MACHINE '$(MACHINE)')
$(error Unknown VENDOR_REV)
endif

# Vendor ID -- IANA Private Enterprise Number:
# http://www.iana.org/assignments/enterprise-numbers
# Accton Technology Corporation IANA number
VENDOR_ID = 259

SKIP_ETHMGMT_MACS = yes

UEFI_ENABLE = yes
PXE_EFI64_ENABLE = yes

# Console parameters
CONSOLE_DEV = 0

# Set Linux kernel version
LINUX_VERSION = 5.4
LINUX_MINOR_VERSION = 86

GCC_VERSION = 8.3.0

#-------------------------------------------------------------------------------
#
# Local Variables:
# mode: makefile-gmake
# End:
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- shell-script -*-

# Demonstration of the init-platform functionality

# This script fragment is sourced by /etc/init.d/init-arch.sh, which
# in turn executes the init_platform_pre_arch() and
# init_platform_post_arch() functions.

# A machine can use this feature to run any early boot scripts needed
# by the machine. A typical usage would be to initialize specific
# hardware devices.

# Use this function to perform any initializations required by the
# architecture specific initialization. This function executes before
# the architecture initializations.
init_platform_pre_arch()
{
_log_info_msg "Info: Setting TX-Enable on OOBF ports... "
i2cset -y -f 0 0x77 0x01 >/dev/null 2>&1
i2cset -y -f 0 0x76 0x10 >/dev/null 2>&1
i2cset -y -f 0 0x62 0x21 0x00 >/dev/null 2>&1
if [ $? -eq 0 ] ; then
_log_info_msg "done.\n"
else
_log_info_msg "failed.\n"
fi
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Use the contents of /sys/class/net/eth0/address

get_ethaddr()
{
[ -r /sys/class/net/eth0/address ] && cat /sys/class/net/eth0/address
}

# Local Variables:
# mode: shell-script
# eval: (sh-set-shell "/bin/sh" t nil)
# End:

0 comments on commit 0ed9e73

Please sign in to comment.