@@ -10,28 +10,60 @@ fdt_addr=0x1000000
1010initrd_addr=0x2000000
1111VAR_LOG=512
1212
13- kernel_fname="/boot/vmlinuz-4.9 .0-9-2-armmp"
14- initrd_fname="/boot/initrd.img-4.9 .0-9-2-armmp"
13+ kernel_fname="/boot/vmlinuz-4.19 .0-9-2-armmp"
14+ initrd_fname="/boot/initrd.img-4.19 .0-9-2-armmp"
1515fdt_fname="/boot/armada-385-ET6448M_4G_Nand.dtb"
1616
17+ if [ "$install_env" = "onie" ]; then
18+ MACH_FILE="/etc/machine.conf"
19+ else
20+ MACH_FILE="/host/machine.conf"
21+ fi
22+ # armhf-marvell_et6448m_52x-r0 - Platform = Et6448M
23+ # armhf-nokia_ixs7215_52x-r0 - Platform = Nokia IPD6448M
24+ PLATFORM=`sed -n 's/^onie_platform=\(.*\)/\1/p' $MACH_FILE`
25+ echo "Intalling SONiC from $install_env on Platform $PLATFORM"
26+
1727# global mount defines
18- demo_dev=ubi0
19- mtd_dev=/dev/$(cat /proc/mtd | grep "SONIC" | grep -o "mtd[0-9]")
20- mtd_num=$(echo $mtd_dev | grep -o "[0-9]")
28+ if [ "$PLATFORM" = "armhf-marvell_et6448m_52x-r0" ]; then
29+ demo_dev=ubi0
30+ mtd_dev=/dev/$(cat /proc/mtd | grep "SONIC" | grep -o "mtd[0-9]")
31+ mtd_num=$(echo $mtd_dev | grep -o "[0-9]")
32+
33+ fdt_fname="/boot/armada-385-ET6448M_4G_Nand.dtb"
34+
35+ BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num' rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs}'
36+ UBI_LOAD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name;ubifsload $fdt_addr $fdt_name; ubifsload $initrd_addr $initrd_name'
37+ BOOTARGS_OLD='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num' rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs_old}'
38+ UBI_LOAD_OLD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name_old;ubifsload $fdt_addr $fdt_name_old; ubifsload $initrd_addr $initrd_name_old'
39+ UBIBOOTCMD='run ubi_sonic_boot_bootargs; run ubi_sonic_boot_load; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
40+ UBIBOOTCMD_OLD='run ubi_sonic_boot_bootargs_old; run ubi_sonic_boot_load_old; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
41+ LINUX_MISC_CMD='apparmor=1 security=apparmor usbcore.autosuspend=-1'
42+
43+ elif [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
44+ demo_dev=sda2
45+
46+ fdt_fname="/boot/armada-385-ipd6448m.dtb"
47+
48+ BOOTARGS='setenv bootargs root=/dev/'$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs}'
49+ UBI_LOAD='scsi init; ext4load scsi 0:2 $kernel_addr $image_name; ext4load scsi 0:2 $fdt_addr $fdt_name; ext4load scsi 0:2 $initrd_addr $initrd_name'
50+ BOOTARGS_OLD='setenv bootargs root=/dev/'$demo_dev' rw rootwait rootfstype=ext4 panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs_old}'
51+ UBI_LOAD_OLD='scsi init; ext4load scsi 0:2 $kernel_addr $image_name_old; ext4load scsi 0:2 $fdt_addr $fdt_name_old; ext4load scsi 0:2 $initrd_addr $initrd_name_old'
52+ UBIBOOTCMD='run ubi_sonic_boot_bootargs; run ubi_sonic_boot_load; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
53+ UBIBOOTCMD_OLD='run ubi_sonic_boot_bootargs_old; run ubi_sonic_boot_load_old; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
54+ LINUX_MISC_CMD='apparmor=1 security=apparmor usbcore.autosuspend=-1'
55+
56+ else
57+ echo "Unsupported Platform $PLAFORM"
58+ exit 2
59+ fi
2160demo_mnt=/tmp
2261FW_ENV_DEFAULT='/dev/mtd0 0x00500000 0x80000 0x100000 8'
2362UBOOT_FW_DEFAULT=1
2463
25- # Skip VID Header in UBIFS
26- BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num',8192 rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs}'
27- UBI_LOAD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name;ubifsload $fdt_addr $fdt_name; ubifsload $initrd_addr $initrd_name'
28- BOOTARGS_OLD='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num',8192 rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts} ${linuxargs_old}'
29- UBI_LOAD_OLD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name_old;ubifsload $fdt_addr $fdt_name_old; ubifsload $initrd_addr $initrd_name_old'
30- UBIBOOTCMD='run ubi_sonic_boot_bootargs; run ubi_sonic_boot_load; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
31- UBIBOOTCMD_OLD='run ubi_sonic_boot_bootargs_old; run ubi_sonic_boot_load_old; test -n "$boot_once" && setenv boot_once "" && saveenv; bootz $kernel_addr $initrd_addr $fdt_addr'
32- LINUX_MISC_CMD='apparmor=1 security=apparmor usbcore.autosuspend=-1'
33-
3464prepare_boot_menu() {
65+ echo "Sync up cache ..."
66+ sync
3567 echo "Setting up U-Boot environment..."
3668
3769 DTB_HAS_ENV_BLK=$(grep uboot-env /proc/mtd | sed -e 's/:.*$//')
@@ -68,6 +100,12 @@ prepare_boot_menu() {
68100 echo $FW_ENV_DEFAULT > /etc/fw_env.config
69101 echo "Using pre-configured uboot env"
70102 fi
103+ if [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
104+ FW_ENV_DEFAULT='/dev/mtd0 0x00100000 0x10000 0x10000'
105+ echo $FW_ENV_DEFAULT > /etc/fw_env.config
106+ echo "Using pre-configured uboot env for armhf-nokia_ixs7215_52x-r0"
107+ fi
108+
71109 image_name=${image_dir}${kernel_fname}
72110 initrd_name=${image_dir}${initrd_fname}
73111 fdt_name=${image_dir}${fdt_fname}
@@ -108,8 +146,8 @@ prepare_boot_menu() {
108146 BORDER='echo "---------------------------------------------------";echo;'
109147 fw_setenv ${FW_ARG} print_menu $BORDER $BOOT1 $BOOT2 $BOOT3 $BORDER > /dev/null
110148
111- fw_setenv ${FW_ARG} linuxargs "net.ifnames=0 loopfstype=squashfs loop=$image_dir/$FILESYSTEM_SQUASHFS varlog_size=$VAR_LOG" > /dev/null
112- fw_setenv ${FW_ARG} linuxargs_old "net.ifnames=0 loopfstype=squashfs loop=$image_dir_old/$FILESYSTEM_SQUASHFS varlog_size=$VAR_LOG" > /dev/null
149+ fw_setenv ${FW_ARG} linuxargs "net.ifnames=0 loopfstype=squashfs loop=$image_dir/$FILESYSTEM_SQUASHFS varlog_size=$VAR_LOG loglevel=4 " > /dev/null
150+ fw_setenv ${FW_ARG} linuxargs_old "net.ifnames=0 loopfstype=squashfs loop=$image_dir_old/$FILESYSTEM_SQUASHFS varlog_size=$VAR_LOG loglevel=4 " > /dev/null
113151
114152 # Set boot configs
115153 fw_setenv ${FW_ARG} kernel_addr $kernel_addr > /dev/null
@@ -122,6 +160,9 @@ prepare_boot_menu() {
122160 else
123161 fw_setenv ${FW_ARG} mtdparts 'mtdparts=armada-nand:4m(uboot)ro,5m@5m(uboot-env),20m@10m(ONIE),-(SONIC)' > /dev/null
124162 fi
163+ if [ "$PLATFORM" = "armhf-nokia_ixs7215_52x-r0" ]; then
164+ fw_setenv ${FW_ARG} mtdparts 'mtdparts=spi0.0:4m(boot),-(spi-rootfs)' > /dev/null
165+ fi
125166 fw_setenv ${FW_ARG} ubi_sonic_boot_mount_ubi 'ubi part SONIC; ubifsmount ubi0' > /dev/null
126167 fw_setenv ${FW_ARG} ubi_sonic_boot_bootargs $BOOTARGS > /dev/null
127168 fw_setenv ${FW_ARG} ubi_sonic_boot_load $UBI_LOAD > /dev/null
@@ -153,9 +194,52 @@ create_ubi_partition() {
153194 ubimkvol /dev/$demo_dev -N $demo_dev -s 3900MiB
154195}
155196
197+ create_gpt_partition() {
198+ blk_dev="/dev/sda"
199+ demo_part=$(sgdisk -p $blk_dev | grep -e "$demo_volume_label" -e "$legacy_volume_label" | awk '{print $1}')
200+ # ONIE partition size 168MB
201+ onie_part_size=168
202+
203+ if [ -z "$demo_part" ] ; then
204+ # Partition Does NOT Exists
205+ echo "SONIC label [$demo_volume_label] is NOT found in Partition"
206+ echo "Proceeding to create partition"
207+
208+ attr_bitmask="0x0"
209+
210+ sgdisk --new=${demo_part}::+${onie_part_size}MB \
211+ --attributes=${demo_part}:=:$attr_bitmask \
212+ --change-name=${demo_part}:$demo_volume_label $blk_dev \
213+ || {
214+ echo "Warning: The first trial of creating partition failed, trying the largest aligned available block of sectors on the disk"
215+ begin=$(sgdisk -F $blk_dev)
216+ end=$(sgdisk -E $blk_dev)
217+ sgdisk --new=${demo_part}:$begin:$end \
218+ --attributes=${demo_part}:=:$attr_bitmask \
219+ --change-name=${demo_part}:$demo_volume_label $blk_dev
220+ } || {
221+ echo "Error: Unable to create partition $demo_part on $blk_dev"
222+ exit 1
223+ }
224+ partprobe || true
225+ else
226+ # Partition Exists
227+ echo "Partition exists $demo_part on $blk_dev"
228+ fi
229+
230+ # Make filesystem
231+ mkfs.ext4 -L $demo_volume_label /dev/$demo_dev
232+ }
233+
156234create_partition() {
157235 # Platform speicific partition
158- create_ubi_partition
236+ if [ "$PLATFORM" = "armhf-marvell_et6448m_52x-r0" ]; then
237+ echo "Doing UBI partition"
238+ create_ubi_partition
239+ else
240+ echo "Doing GPT partition"
241+ create_gpt_partition
242+ fi
159243}
160244
161245mount_partition() {
@@ -166,14 +250,22 @@ mount_partition() {
166250 }
167251
168252 echo "Mounting $demo_dev on $demo_mnt "
169- trap_push "${onie_bin} umount /dev/ubi0_0|| true"
170- mount -t ubifs /dev/ubi0_0 $demo_mnt || {
171- echo "Failed"
172- }
253+ if [ "$PLATFORM" = "armhf-marvell_et6448m_52x-r0" ]; then
254+ trap_push "${onie_bin} umount /dev/ubi0_0|| true"
255+ mount -t ubifs /dev/ubi0_0 $demo_mnt || {
256+ echo "mount -t ubifs /dev/ubi0_0 $demo_mnt Failed"
257+ exit 1
258+ }
259+ else
260+ trap_push "${onie_bin} umount /dev/sda2|| true"
261+ mount -t ext4 /dev/sda2 $demo_mnt || {
262+ echo "mount -t ext4 /dev/sda2 $demo_mnt Failed"
263+ exit 1
264+ }
265+ fi
173266}
174267
175268bootloader_menu_config() {
176269 # Update uboot Environment
177270 prepare_boot_menu
178271}
179-
0 commit comments