Welcome to techfury90's tutorial on how to obsessively prepare a "clean" hatbowled BCM50 HDD!

Pre-requisite materials: 

1. You MUST upgrade the firmware to R5/R6 level BEFORE beginning! See the section titled "How to upgrade firmware" at the bottom to learn how.
2. You will need a 160 GB or larger BCM-compatible HDD. A known-working drive used by Avaya is the Seagate Barracuda 7200.12, model ST3160318AS, available for around $20 on eBay as of March 2021.
3. You will need the following files: 
- bcm_multi_image.qcow2 (image of the Avaya Multi-Image BCM50/450 HDD)
- cfsserver.hatbowl (modified keycode server, for hatbowling)
- The following BCM updates from Avaya:
- BCM050.R600.SU.System-022.201412-1.zip
- BCM050.R600.SU.Desktop-005.201406-1.zip
- BCM050.R600.SAMBA-136-1.zip
- BCM050.R600.UTPS-138-1.zip
4. Optionally, you may want a backup from your existing BCM configuration. Even if your backups do not restore on your existing BCM setup, they will restore fine on a proper BCM drive build as outlined in my experience.

1. Zero out the HDD (optional, to make making an image more compact)
2. Restore the multi-image HDD image using a command along the lines of qemu-img dd -f qcow2 -O raw if=bcm_multi_image.qcow2 of=/dev/sdb
3. Connect a laptop to the OAM port, configure it for static IP 10.10.11.2/24
4. Apply power to BCM.
5. Wait for the power LED to be green, and the status LED flashing yellow/orange. This will take approximately 2 minutes from applying power.
6. Open a ssh connection to 10.10.11.1, using username nnadmin, password PlsChgMe! A menu will appear.
7. Choose option 1, "Install and Activate a BCM SW Release"
8. You will be prompted for which version to install. If you do not see R5 and R6 listed, STOP. You need to upgrade your firmware using the pre-existing hatbowl image and try again.
9. Choose BCM50 R6. After confirming, both LEDs will turn red. Since the BCM50 R6 image is already installed, it will only need to be activated. This will take approximately 1 minute.
10. The BCM will now reboot into a factory-fresh BCM50 R6 installation. Wait about 10 minutes for both LEDs to turn green.
11. Once both LEDs are green, connect to the BCM using BEM. Change your nnadmin password as prompted by BEM. 
12. Open up a ssh connection to nnsupport@10.10.11.1. Obtain your password of the day from https://vofr.net/bcm-potd/
13. You should now have a bash shell. Leave it open for now.
14. Use a SCP or SFTP client to upload cfsserver.hatbowl to /tmp, using the nnsupport credentials. 
15. Return to the bash shell, and escalate to root using su - with the password li69nux.
16. Stop the cfsserver service with /etc/init.d/cfsserver stop
17. Copy /tmp/cfsserver.hatbowl over /nn/sbin/cfsserver, using cp /tmp/cfsserver.hatbowl /nn/sbin/cfsserver
18. Restart cfsserver with /etc/init.d/cfsserver start
19. Return to BEM. If your BCM has previously been hatbowled, your hatbowl keycode information will now appear under Configuration->System->Keycodes. If it has not been previously hatbowled, you can now upload your hatbowl keycode.
20. It is now time to install the BCM updates from Avaya. Unpack the 4 zip files to separate folders.
21. Before proceeding, it is necessary to set the date/time and time zone from Configuration->System->Date and Time.
22. In BEM, go to Administration->Software Management->Software Updates. Click on "Get New Updates...", choose Retrieve From: My Computer. There may be a delay of about a minute before you get the file browse dialog. Browse to the folder you unpacked BCM050.R600.SU.System-022.201412-1.zip to. Wait for the updates to validate. Once they have validated, select the update from the list and press apply. The update will then upload and apply. After the update applies, the BCM will reboot.
23. Repeat step 22 for the other 3 update packages.


Example initial ssh SSH session:

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2021.03.28 11:56:29 =~=~=~=~=~=~=~=~=~=~=~=
login as: nnadmin
Keyboard-interactive authentication prompts from server:
| Time : Sun Mar 28 14:43:19 2021
| System ID : 060607080305
| Password: 
End of keyboard-interactive prompts from server

-----------------------------------------------------------------------
............... BUSINESS COMMUNICATIONS MANAGER .......................
-----------------------------------------------------------------------

 QUICK CONFIGURATION 
=======================================================================

(0)--->Exit
(1)--->Install and Activate a BCM SW Release
(2)--->Advanced Menu
(3)--->Display status of BCM SW Release installation
(4)--->Reboot
(5)--->Shutdown
(6)--->Help

=======================================================================

Make Selection [ 0 1 2 3 4 5 6 ] : 1
Install is currently not running
Detecting Hardware, Please wait!


The current status is: BCM50 R6 Is Ready for quick Install Stage

        The current status is: BCM50 R6 Is Ready for quick Install Stage

                   Install and Activate a BCM SW Release menu
        =======================================================================

        (0) ---> Return to Main Menu
        (1) ---> BCM50 R5
        (2) ---> BCM50 R6

        =======================================================================

        Enter the number representing the SW release you want to install : 2

After installation is complete the BCM will automatically reboot into the
selected SW Rel BCM50 R6!

Do you wish to continue with installation of BCM50 R6? [y/n] y
.
BCM50 R6 Activation Stage
.....
BCM50 R6 Rebooting Stage
.

Broadcast message from root (Sun Mar 28 14:46:20 2021):




The system is going down for reboot NOW!


Example hatbowl ssh session:

login as: nnsupport
Keyboard-interactive authentication prompts from server:
| System Release : 10.0.1.02.115-0
| Date : Sun Mar 28 15:05:01 2021
|
| 00159BFE9342
| Password:
End of keyboard-interactive prompts from server

*********************************************************
                 Avaya BCM50 Release 6
                       Build 1.02
*********************************************************

WARNING!  This computer system and network is PRIVATE and
PROPRIETARY and may only be accessed by authorized users.
Unauthorized use of this computer system or network is
strictly prohibited and may be subject to criminal prosecution,
employee discipline up to and including discharge, or the
termination of vendor/service contracts.  The owner, or its
agents, may monitor any activity or communication on the
computer system or network.  The owner or its agents may
retrieve any information stored within the computer system or
network. Users should have no expectation of privacy as to any
communication on or information stored within the computer
system or network, including information stored locally or
remotely on a hard drive or other media in use with this
computer system or network.
-bash-2.05b$ su -
Password:
[root@bcm50 root]# ls -l /nn/sbin/cfsserver
-rwxr-xr-x    1 root     root       286061 Jun 23  2010 /nn/sbin/cfsserver
[root@bcm50 root]# /etc/init.d/cfsserver stop
                                                           [  OK  ]
[root@bcm50 root]# cp /tmp/cfsserver.hatbowl /nn/sbin/cfsserver
cp: overwrite `/nn/sbin/cfsserver'? y
[root@bcm50 root]# ls -l /nn/sbin/cfsserver
-rwxr-xr-x    1 root     root       286061 Mar 28 15:16 /nn/sbin/cfsserver
[root@bcm50 root]# /etc/init.d/cfsserver start
assigning class and priority
[root@bcm50 root]#


How to upgrade firmware

This is most easily done from the original hatbowl image. Note that after performing these steps, the original hatbowl image will cease to boot, as the kernel file name has changed. 

First, you will need to determine your current firmware version. Log in as nnsupport over ssh with the password of the day, and escalate to root using su - with the password li69nux. Look at the output of the fw_printenv command for a line beginning with u-boot_version to determine your current firmware level.

Known values:
R1/possibly R2: CSC U-Boot 2.04.01 (Jul 12 2005 - 18:25:35)
R3: CSC U-Boot 2.06.4 (Aug  7 2007 - 16:15:37)
R5/R6: CSC U-Boot 2.06.6 (Aug 17 2009 - 17:07:17)

If your current firmware is R1/R2 level:
[root@bcmm50r2 root]# cd /nn/patches/scripts/install
[root@bcmm50r2 install]# mkdir /nn/upgrade
[root@bcmm50r2 install]# touch /nn/upgrade/Upgrade.M50R2-to-M50R6
[root@bcmm50r2 install]# ./bsp-u-boot.sh
1433120 CSC U-Boot 2.06.6 (Aug 17 2009 - 17:07:17)
Erased 640 Kibyte @ 0 -- 100% complete.
1433120 CSC U-Boot 2.06.6 (Aug 17 2009 - 17:07:17)
Tue Mar 23 19:43:24 EDT 2021 uboot flash image updated
[root@bcmm50r2 install]# ./bsp-u-boot-env.sh
Unlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd2...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd3...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd2...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd3...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd2...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd3...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd2...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd3...Done
Locking ...Done
[root@bcmm50r2 install]# ./bsp-fpga-fw.sh
Erased 576 Kibyte @ 0 -- 100% complete.
Tue Mar 23 19:43:57 EDT 2021  Checking image in flash
*** Warning: "/tmp/spoo" has corrupted data!
size of image_header_t:00000040
Image Name:   FPGA csc_r1 rel 25
Created:      Tue Aug  7 16:15:29 2007
Image Type:   PowerPC Fpga Firmware (gzip compressed)
Data Size:    48956 bf3c Bytes = 47.81 kB = 0.05 MB
Crc32 Hdrcalc:0xC5B1858F
Crc32 Imgage: 0xCC6D45BE
Load Address: 0x00010000
Entry Point:  0x00000000
*** Warning: "/tmp/spoo" has corrupted data!
Image Name:   FPGA csc_r1 rel 25
Crc32 Imgage: 0xCC6D45BE
Tue Mar 23 19:43:57 EDT 2021 fpga flash image updated
[root@bcmm50r2 install]# rm /nn/upgrade/Upgrade.M50R2-to-M50R6
[root@bcmm50r2 install]# rm -rf /nn/upgrade


If your current firmware is R3 level (note: there is no FPGA upgrade like there is when going from R1 or R2):


[root@bcmm50r2 root]# cd /nn/patches/scripts/install
[root@bcmm50r2 install]# mkdir /nn/upgrade
[root@bcmm50r2 install]# touch /nn/upgrade/Upgrade.M50R3-to-M50R6
[root@bcmm50r2 install]# ./bsp-u-boot.sh
1433120 CSC U-Boot 2.06.6 (Aug 17 2009 - 17:07:17)
Erased 640 Kibyte @ 0 -- 100% complete.
1433120 CSC U-Boot 2.06.6 (Aug 17 2009 - 17:07:17)
Tue Mar 23 19:43:24 EDT 2021 uboot flash image updated
[root@bcmm50r2 install]# ./bsp-u-boot-env.sh
Unlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd2...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd3...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd2...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd3...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd2...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd3...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd2...Done
Locking ...DoneUnlocking flash...Done
Erasing flash...Done
Writing environment to /dev/mtd3...Done
Locking ...Done
[root@bcmm50r2 install]# rm /nn/upgrade/Upgrade.M50R3-to-M50R6
[root@bcmm50r2 install]# rm -rf /nn/upgrade