Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build/onie installer] Install grub for SONiC post migration from another NOS #949

Merged
merged 2 commits into from
Sep 17, 2017
Merged

[build/onie installer] Install grub for SONiC post migration from another NOS #949

merged 2 commits into from
Sep 17, 2017

Conversation

padmanarayana
Copy link
Contributor

- What I did

Currently, while migrating from another NOS into SONiC, SONiC will boot using the NOS's grub. After migration, it is desirable to install a grub for SONiC use rather than depend on NOS's grub so that subsequent reboots will use SONiC's own grub.

- How I did it

  1. During sonic-broadcom.raw build, generate and bundle a grub.cfg for use after migration.
  2. During SONiC init post migration, the ONIE’s grub is extracted and installed into SONiC.
  3. The platform constants are updated in the grub.cfg and the ONIE, Diag entries are also added and installed into SONiC’s newly installed grub. Currently the serial port, device and the SONiC root partition are updated post migration (since these are platform specific). Other parameters (say, CONSOLE_SPEED) may be added if necessary.
  4. Extraction of the ONIE’s grub required xz and the ONIE script to generate the ONIE & Diag grub configs needed sgdisk.

- How to verify it

  1. Check that after dd (using sonic-broadcom.raw image), the boots into SONiC using the NOS's grub (sanity check is to see the grub menu entries).
  2. After migration into SONiC check that SONiC's grub is correctly installed in /host/grub.
  3. Reboot the unit and check that SONiC now comes up with SONiC's grub rather than the NOS's grub.
  4. Reboot to check that with SONiC's grub, it is possible to get into ONIE.

- Description for the changelog

Install grub for SONiC post migration from another NOS

- A picture of a cute animal (not mandatory but encouraged)

@msftclas
Copy link

msftclas commented Sep 9, 2017

@padmanarayana,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by Microsoft. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot


# Extract ONIE's ramdisk which contain's the ONIE grub
mount $onie_dev /mnt/onie-boot
cp /mnt/onie-boot/onie/initrd.img-3.2.69-onie initrd.img-3.2.69-onie.xz
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.img-3.2.69-onie initrd.img-3.2.69- [](start = 37, length = 35)

hardcoding onie kernel version does not sound a good design. this puts the sonic installation process highly dependent on the onie installer we have in the box. In the future, you may ship a ftos box with newer onie, then this will break.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for example, on my box the onie is initrd.img-3.2.35-onie

@lguohan
Copy link
Collaborator

lguohan commented Sep 12, 2017

can you test the sonic-to-sonic upgrade after you install the sonic? does it work?


# The SONiC "raw" build mode has already generated a proto grub.cfg
# as part of the migration. Platform specific constants need to be
# retrieved from installer.conf and assigned.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is default value. 9600 ttyS0 for CONSOLE_PORT and dev. If it is the default value, then installer.conf will not have those values.

@@ -543,7 +554,7 @@ menuentry '$demo_grub_entry' {
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
linux /$image_dir/boot/vmlinuz-3.16.0-4-amd64 root=$demo_dev rw $GRUB_CMDLINE_LINUX \
linux /$image_dir/boot/vmlinuz-3.16.0-4-amd64 root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \
loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \
apparmor=1 security=apparmor varlog_size=$VAR_LOG_SIZE $ONIE_PLATFORM_EXTRA_CMDLINE_LINUX
Copy link
Collaborator

@lguohan lguohan Sep 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the rc.local, you also need to replace the VAR_LOG_SIZE in case the VAR_LOG_SIZE is overriden in the installer.conf


# Get the device and grub directory to be used for grub-install
sonic_dev=$(blkid | grep SONiC-OS | head -n 1 | awk '{print $1}' | sed -e 's/[0-9]:.*$//')
grub_platform_dir=`find . -name kernel.img -print`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this file? there is no such file in initrd.img for 3.2.35.

else
DEFAULT_GRUB_SERIAL_COMMAND="serial --port=${CONSOLE_PORT} --speed=${CONSOLE_SPEED} --word=8 --parity=no --stop=1"
DEFAULT_GRUB_CMDLINE_LINUX="console=tty0 console=ttyS${CONSOLE_DEV},${CONSOLE_SPEED}n8 quiet"
fi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the original lines, here. In the rc.local, there the installer.conf override, then change the PORT and SPEED accordingly, otherwise, do not change.

@lguohan lguohan merged commit 6935e00 into sonic-net:master Sep 17, 2017
lguohan added a commit that referenced this pull request Jul 7, 2019
sonic-swss:

* 67f7191 2019-06-20 | Set timer only when interval changes. Not in each firing of the timer. (#945) (HEAD -> 201803, origin/201803) [Renuka Manavalan]
* 2cae61b 2019-07-07 | Fix: crash while destructing crmorch (#731) (#949) [Renuka Manavalan]

sonic-swss-common:

* 58b1930 2019-07-07 | Add an assert to logger, which will log a message and abort. (#286) (#287) (HEAD -> 201803, origin/201803) [Renuka Manavalan]
zhenggen-xu pushed a commit to zhenggen-xu/sonic-buildimage that referenced this pull request Oct 17, 2019
* msft_github/master:
  [snmpagent]: Update sonic-snmpagent submodule (sonic-net#1004)
  [swss]: Update the ipinip.j2 template to specify the IPv4 loopback address (sonic-net#998)
  Change all port_config.ini column headers from 'port' to 'index' (sonic-net#1001)
  [docker-platform-monitor]: Remove stale fancontrol.pid file (if exists) before starting fancontrol (sonic-net#1002)
  [swss]: Update swss/common submodules (sonic-net#988)
  [snmp]: Update py-swsssdk/snmpagent submodules (sonic-net#996)
  [Broadcom]: Update SAI version to 3.0.3.2-5 (sonic-net#997)
  [Mellanox]: Update outdated MSN2410 minigraph (sonic-net#995)
  Add time stamp suffix to the dirty images version string (sonic-net#958)
  [Mellanox]: Remove FW upgrade procedure in docker (sonic-net#989)
  [snmp]: Update sonic-snmpagent submodule (sonic-net#986)
  [Broadcom]: Update SAI version to 3.0.3.2-4 (sonic-net#983)
  [Ingrasys]: Add Ingrasys S8900-64XC sfputil function and update submodule (sonic-net#984)
  [mellanox]: Update Mellanox SAI version (sonic-net#979)
  [Ingrasys]: Change hwmon kernel modules installation order (sonic-net#980)
  [Makefile] Allowing interactive session with the slave docker-container (sonic-net#903)
  [snmp]: Update sonic-snmpagent submodule (sonic-net#978)
  Disable snmpd module disk_hw, so no syslog messages about unavailable disks (sonic-net#977)
  [teamd]: Remove deprecated blocking logic before starting teamd (sonic-net#976)
  [Broadcom]: Update libsai version to 3.0.3.2-2 (sonic-net#973)
  [device/accton]: Add a new supported device, AS7312-54X (sonic-net#955)
  [sairedis]: update sairedis submodule (sonic-net#974)
  lacp runner will send lacp update right after it received SIGINT (sonic-net#969)
  [config]: Fix management interface configuration (sonic-net#966)
  [Broadcom]: Update OpenNSL modules (sonic-net#970)
  [utilities]: Update sonic-utilities (sonic-net#968)
  [interfaces]: Change MTU value to 9100  (sonic-net#967)
  Framework to plugin Organization specific scripts during ONIE Image build  (sonic-net#951)
  Always start with Forwarding State flag set for bgpd (sonic-net#963)
  Update sonic-utilities to be compatible with sonic-net#942 (sonic-net#965)
  [swss]: Fix the command to get HWSKU with sonic-cfggen (sonic-net#964)
  [bgp]: Fix the deployment_id with DEVICE_METADATA (sonic-net#962)
  [Ingrasys] Update Ingrasys submodule for S8900-54XC (sonic-net#954)
  [build/onie installer] Install grub for SONiC post migration from another NOS (sonic-net#949)
  [syncd]: Comment out unused docker-ptf-brcm.mk
  [Broadcom]: Update OpenNSL/SAI version (sonic-net#959)
  [swss]: Move swss/common/sairedis submodule to 201709 tag
  [sairedis]: update sairedis submodule head (sonic-net#956)
  [service template] Starting new docker when HWSKU change is detected (sonic-net#946)
  [config] Fix an issue that bgp asn data type is not consistent (sonic-net#953)
  [mellanox]: Update Mellanox SAI version ansd SDK version
  [Ingrasys] update port_config.ini and sfputil for ingrasys platforms (sonic-net#952)
  [frr]: RR client support in minigraph for FRR (sonic-net#923)
  [configdb] Migrate minigraph configurations to DB (sonic-net#942)
  [devices]: Add led plugin for Arista 7060CX-32S and 7260CX3-64 (sonic-net#945)
  [sonic-slave]: SLAVE_TAG should be for both Dockerfile and Dockerfile.user (sonic-net#950)
  [github]: add templates for submitting issues and PR (sonic-net#947)
  [rsyslog]: Use timegenerated instead of timestamp (sonic-net#944)
  [dell]: remove nos_to_sonic_grub.cfg (sonic-net#943)
  [slave.mk]: Apply series of patches to SONIC_PYTHON_STDEB_DEBS targets if they exist (sonic-net#941)
  [rsyslog]: Use SONiC template in containers (sonic-net#940)
  [Broadcom]: Remove BRCM_OPENNSL library and upgrade BRCM_SAI to 3.0.3.2 (sonic-net#938)
  [baseimage]: allocate varlog disk in the initramfs stage (sonic-net#936)
  [sairedis]: revert deadlock fix in sonic-sairedis submodule (sonic-net#934)
  Replace CRLF line endings with LF (sonic-net#932)
  Fix confusing comment (sonic-net#931)
  Update sfputil support for Ingrasys S9100 (sonic-net#929)
  [quagga]: Disable ipv4 over ipv6 and enable ipv6 over ipv4 peer group (sonic-net#922)
  [quagga] enable core dump for bgpd and zebra (sonic-net#927)
  [devices]: Update Dell s6100/z9100 platform modules (sonic-net#925)
  Revert "Migrate DEVICE_METADATA to db (sonic-net#919)" (sonic-net#928)
  Migrate DEVICE_METADATA to db (sonic-net#919)
  [devices]: Bump sonic-platform-modules-arista submodule (sonic-net#924)
  [image]: build sonic-broadcom.raw image for sonic conversion from ftos (sonic-net#901)
  [sonic-slave] Force pyangbind version to 0.5.10 (sonic-net#918)
  [Arista-7260CX3] Rename hwSKU Arista-7260CX3-64 to Arista-7260CX3-C64, introducing new hwSKU Arista-7260CX3-D108C8 (sonic-net#920)
  [devices]: modify sfputil plugins for mellanox devices for new platform API (sonic-net#916)
  [cavm]Update sai revision and packet driver (sonic-net#914)
  [translate-acl] Specify pyangbind version to not introduce new dependency (sonic-net#915)
  Update sfputil support for Arista platforms (sonic-net#912)
  Port speed (sonic-net#879)
  [Accton]: Add a new supported device AS5712-54X (sonic-net#898)
  [kernel]: update kernel submodule (sonic-net#910)
  [device]: Updated dell s6100 submodule to 5ab014 (sonic-net#909)
  [broadcom]: update broadcom sai package to 2.1.5.1-17 (sonic-net#908)
  IPv4 prefixes shouldn't be sent by default over IPv6 session with FRR. (sonic-net#905)
  [submodule]: update sonic linux kernel (sonic-net#906)
  [sonic-sairedis] update sairedis submodule (sonic-net#211, sonic-net#212) (sonic-net#904)
  [mlnx-fw-upgrade]: Define required FW version in build time. (sonic-net#902)
  [SAI]: Remove the SAI submodule from buildimage repo (sonic-net#893)
  [Submodule update]: sonic-utilities (sonic-net#888)
  Revert "[mellanox]: Update Mellanox SAI version"
  [mellanox]: Update Mellanox SAI version
  [utilities]: Update sonic-utilities submodule
  [swss-common]: Update sonic-swss-common submodule
  [mellanox]: Disable fsat boot mode for SX kernel
  [quagga]: Update sonic-quagga submodule
  [Broadcom]: Update Broadcom SAI/SDK version (sonic-net#883)
  Squash merge v1.0.3 branch onto master
AidanCopeland pushed a commit to Metaswitch/sonic-buildimage that referenced this pull request Apr 14, 2022
mssonicbld added a commit that referenced this pull request Nov 22, 2024
…omatically (#20854)

#### Why I did it
src/sonic-swss-common
```
* ebd2afb - (HEAD -> master, origin/master, origin/HEAD) Supports FRR-VRRP configuration (#813) (25 hours ago) [Philo]
* fe30ccd - [DASH] Add DASH Meter Policy , Rule , Counter table definitions (#949) (2 days ago) [Sundara Gurunathan]
* 901f3b4 - [common] enable redispipeline to only publish after flush (#895) (3 days ago) [Yijiao Qin]
```
#### How I did it
#### How to verify it
#### Description for the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants