How to Boot from NVMe SSD?

After reflashing to JetPack 4.4 DP I had time to play with booting from SSD again and here are some remarks. Because forum fobids sharing archives with scripts, formated text will be included.

  1. I added conditional start for service on /etc/setssdroot.conf (on mmcblk0p1) availability. To mount rootfs from eMMC, file /etc/setssdroot.conf on mmcblk0p1 should be deleted.
    setssdroot.service:

[Unit]
Description=Change rootfs to SSD in M.2 key M slot (nvme0n1p1)
DefaultDependencies=no
Conflicts=shutdown.target
After=systemd-remount-fs.service
Before=local-fs-pre.target local-fs.target shutdown.target
Wants=local-fs-pre.target
ConditionPathExists=/dev/nvme0n1p1
ConditionPathExists=/etc/setssdroot.conf
ConditionVirtualization=!container
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/setssdroot.sh
[Install]
WantedBy=default.target

  1. setssdroot.service and setssdroot.sh should be on both mmcblk0p1 and nvme0n1p1 else service report error to journal, still switching rootfs.

  2. At JetPack 4.4 propoused to install new kernels and modules with deb packet. One should remember, that after installation, kernel, initrd and modules to rootfs switched to SSD would be placed on /boot/* and /lib/modules/[kernel name]/ on SSD and should manualy be copied to same folders on mmcblk0p1. Because Image and initrd, located in mmcblk0p1 /boot folder, pointed by /boot/extlinux/extlinux.conf data in mmcblk0p1, is booting with CBoot. If modules version in initrd on mmcblk0p1 and /lib/modules/[kernel name]/ on SSD will be different, modules load will be tainted.

So, step by step guid will be the following:

  • Flash Xavier with rootfs on eMMC (default with SDKManager)

  • Install default software, that will be needed on main (SSD) and restoration (eMMC) systems.

  • Copy rootfs to SSD.

#!/bin/bash
sudo mount /dev/nvme0n1p1 /mnt
sudo rsync -aAXv / --exclude={“/dev/“,”/proc/”,“/sys/“,”/tmp/”,“/run/“,”/mnt/”,“/media/*”,“/lost+found”} /mnt

  • Install service (steps 3-5 from my previous post, setssdroot.service from top of this post).

  • Copy service files to SSD

sudo cp /etc/systemd/system/setssdroot.service /mnt/etc/systemd/system/setssdroot.service
sudo cp /sbin/setssdroot.sh /mnt/sbin/setssdroot.sh

  • Install software for restoration rootfs (on eMMC). It is possible to reboot back in this rootfs if /etc/setssdroot.conf file is absent.

  • Create file /etc/setssdroot.conf

sudo touch /etc/setssdroot.conf

  • Reboot system. You will boot in new rootfs located in SSD.
    Don’t forget to synchronize /boot/ /lib/modules/ folders with eMMC when moding kernels.

When rootfs on SSD is used, /dev/mmcblk0 is unmounted, so we can backup it with dd.
Rootfs on SDD can be safely backed after loading back into rootfs on eMMC:

sudo mount /dev/mmcblk0p1 /mnt
sudo rm /mnt/etc/setssdroot.conf
reboot

For backups I use SSD drive connected to M.2 key E throught M.2 key E to m.2 key M adapter from aliexpress.

3 Likes

There is another method to mount rootfs on SSD in JetPack 4.4. Now initrd is located with kernel image in /boot/ folder on /dev/mmcblk0p1. Loaded initrd is set in INITRD initrd_file line in /boot/extlinux/extlinux.conf on /dev/mmcblk0p1.

LABEL primary
         MENU LABEL primary kernel
         LINUX /boot/Image
         INITRD /boot/initrd

It’s possible to unpack initrd:

#!/bin/bash
sudo mkdir newinitrd
cd newinitrd
sudo cp /boot/initrd …/initrd
gzip -cd …/initrd | cpio -imd

Now we can change script init to change variable rootdev.
My test variant of init:

#!/bin/bash
initrd_dir=/mnt/initrd;
dhclient_flag=“true”;
count=0;

echo “Starting L4T initial RAM disk” > /dev/kmsg;

#Mount procfs, devfs, sysfs and debugfs
mount -t proc proc /proc
if [ $? -ne 0 ]; then
echo “ERROR: mounting proc fail…” > /dev/kmsg;
exec /bin/bash;
fi;
mount -t devtmpfs none /dev
if [ $? -ne 0 ]; then
echo “ERROR: mounting dev fail…” > /dev/kmsg;
exec /bin/bash;
fi;
mount -t sysfs sysfs /sys
if [ $? -ne 0 ]; then
echo “ERROR: mounting sys fail…” > /dev/kmsg;
exec /bin/bash;
fi;
mount -t debugfs none /sys/kernel/debug/
if [ $? -ne 0 ]; then
echo “ERROR: mounting debugfs fail…” > /dev/kmsg;
exec /bin/bash;
fi;

create reboot command based on sysrq-trigger

if [ -e “/proc/sysrq-trigger” ]; then
echo -e “#!/bin/bash \necho b > /proc/sysrq-trigger;” > /sbin/reboot;
chmod 755 /sbin/reboot;
fi;

ssdroot parameter at extlinux.conf

rootdev=“$(sed -ne ‘s/.\bssdroot=/dev/([abcdefklmnps0-9])\b.*/\1/p’ < /proc/cmdline)”
if [ “${rootdev}” != “” ]; then
echo “Root from sddroot parameter found: ${rootdev}” > /dev/kmsg;
fi
if [ “${rootdev}” == “” ]; then

real root parameter

rootdev=“$(sed -ne 's/.\broot=/dev/([abcdefklmnps0-9])\b./\1/p’ < /proc/cmdline)"
fi
if [ “${rootdev}” == “” ]; then
uuid_regex=‘[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}’
rootdev="$(sed -ne "s/.
\broot=(PARTUUID=${uuid_regex})\b.*/\1/p” < /proc/cmdline)"
fi

if [ “${rootdev}” != “” ]; then
echo “Root device found: ${rootdev}” > /dev/kmsg;
fi

added branch for nvme

if [[ “${rootdev}” == nvme* ]]; then
if [ ! -e “/dev/${rootdev}” ]; then
count=0;
while [ ${count} -lt 50 ]
do
sleep 0.2;
count=expr $count + 1;
if [ -e “/dev/${rootdev}” ]; then
break;
fi
done
fi
if [ -e “/dev/${rootdev}” ]; then
echo “Found dev node: /dev/${rootdev}” > /dev/kmsg;
else
echo “ERROR: ${rootdev} not found” > /dev/kmsg;
exec /bin/bash;
fi
mount /dev/${rootdev} /mnt/;
if [ $? -ne 0 ]; then
echo “ERROR: ${rootdev} mount fail…” > /dev/kmsg;
exec /bin/bash;
fi;
elif [[ “${rootdev}” == PARTUUID* ]]; then
count=0;
while [ ${count} -lt 50 ]; do
sleep 0.2;
count=“$(expr ${count} + 1)”

  mount "${rootdev}" /mnt/;
  if [ $? -eq 0 ]; then
  	break;
  fi

done
mountpoint /mnt/;
if [ $? -ne 0 ]; then
echo “ERROR: ${rootdev} mount fail…” > /dev/kmsg;
exec /bin/bash;
fi;
elif [[ “${rootdev}” == mmcblk* ]]; then
if [ ! -e “/dev/${rootdev}” ]; then
count=0;
while [ ${count} -lt 50 ]
do
sleep 0.2;
count=expr $count + 1;
if [ -e “/dev/${rootdev}” ]; then
break;
fi
done
fi
if [ -e “/dev/${rootdev}” ]; then
echo “Found dev node: /dev/${rootdev}” > /dev/kmsg;
else
echo “ERROR: ${rootdev} not found” > /dev/kmsg;
exec /bin/bash;
fi
mount /dev/${rootdev} /mnt/;
if [ $? -ne 0 ]; then
echo “ERROR: ${rootdev} mount fail…” > /dev/kmsg;
exec /bin/bash;
fi;
elif [[ “${rootdev}” == sd* ]]; then
if [ ! -e “/dev/${rootdev}” ]; then
while [ ${count} -lt 50 ]
do
sleep 0.2;
count=expr $count + 1;
if [ -e “/dev/${rootdev}” ]; then
break;
fi
done
fi
if [ -e “/dev/${rootdev}” ]; then
echo “Found dev node: /dev/${rootdev}” > /dev/kmsg;
else
echo “ERROR: ${rootdev} not found” > /dev/kmsg;
exec /bin/bash;
fi
mount /dev/${rootdev} /mnt/;
if [ $? -ne 0 ]; then
echo “ERROR: ${rootdev} mount fail…” > /dev/kmsg;
exec /bin/bash;
fi;
elif [[ “${rootdev}” == “nfs” ]]; then
eth=cat /proc/cmdline | sed 's/.* ip=\([a-z0-9.:]*\) .*/\1/' | awk -F ":" '{print $6}';
echo “Ethernet interface: $eth” > /dev/kmsg;
ipaddr=ifconfig "$eth" | grep -A1 "$eth" | grep "inet addr" | sed 's/.*addr:\([0-9\.]*\) .*/\1/';
if [[ “$ipaddr” =~ [0-9].[0-9].[0-9].[0-9] ]]; then
echo “IP Address: $ipaddr” > /dev/kmsg;
dhclient_flag=“false”;
else
while [ ${count} -lt 50 ]
do
sleep 0.2;
ipaddr=ifconfig "$eth" | grep -A1 "$eth" | grep "inet addr" | sed 's/.*addr:\([0-9\.]*\) .*/\1/';
if [[ “$ipaddr” =~ [0-9].[0-9].[0-9].[0-9] ]]; then
echo “IP Address: $ipaddr” > /dev/kmsg;
dhclient_flag=“false”;
break;
fi
count=expr $count + 1;
done
fi
if [ “$dhclient_flag” == “true” ]; then
timeout 8s /sbin/dhclient $eth;
if [ $? -ne 0 ]; then
echo “ERROR: dhclient fail…” > /dev/kmsg;
exec /bin/bash;
fi;
fi;
nfsroot_path=“cat /proc/cmdline | sed -e 's/.*nfsroot=\([^ ,]*\)[ ,].*/\1 /'”;
nfsroot_opts=“cat /proc/cmdline | sed -ne 's/.*nfsroot=\([^ ,]*\),\([^ ]*\).*/\2 /p'”;
if [[ “${nfsroot_opts}” == “” ]]; then
nfsroot_opts=“nolock”
fi
mount -t nfs -o ${nfsroot_opts} ${nfsroot_path} /mnt/ &>/dev/kmsg;
if [ $? -ne 0 ]; then
echo “ERROR: NFS mount fail…” > /dev/kmsg;
exec /bin/bash;
fi;
else
echo “No root-device: Mount failed” > /dev/kmsg;
exec /bin/bash;
fi

echo “Rootfs mounted over ${rootdev}” > /dev/kmsg;
mount -o bind /proc /mnt/proc;
mount -o bind /sys /mnt/sys;
mount -o bind /dev/ /mnt/dev;
cd /mnt;
cp /etc/resolv.conf etc/resolv.conf

echo “Switching from initrd to actual rootfs” > /dev/kmsg;
mount --move . /
exec chroot . /sbin/init 2;

And repack initrd:

#!/bin/bash
find . -print0 | cpio --null --quiet -H newc -o | gzip -9 -n > …/initrdtossd
sudo cp …/initrdtossd /boot/initrdtossd

Now we need to change extlinux.conf to primary boot option and create secondary!!! (uncomment at end of the file).

LABEL primary
         MENU LABEL primary kernel
         LINUX /boot/Image
         INITRD /boot/initrdtossd
         APPEND {bootargs} ssdroot=/dev/nvme0n1p1 

!!!
This method is only propoused. I couldn’t make it work yet.
rootdev variable is empty at highlighted line from init, while /proc/cmdline consists string ssdroot=/dev/nvme0n1p1 and /dev/nvme0n1p1 is visible when system boot is stopped in initrd:

rootdev=“$(sed -ne ‘s/.\bssdroot=/dev/([abcdefklmnps0-9])\b.*/\1/p’ < /proc/cmdline)”

Any advice?

Just wanted to say, ty so much @crazy_yorick for your work on this thus far. I have one of the new Xavier NX dev kits, and I’m very interested in having the root of the filesystem be on my extremely fast m2 nvme, rather than my extremely slow sd card. Does anyone know if this has been tried on a Xavier NX?

Hello, I would also be very interested, as @erikneffca, to learn how to move the root to an SSD drive of Xavier NX. As soon as I start installing things (e.g. jetson-inference Python library that requires PyTorch), SD card gets saturated. I am new to Jetson community so I tried to apply same procedures that were suggested for other Jetson modules to boot from SSD. However, it seems that the bootloader on NX is different and it didn’t work for me.

Another approach would be to extend root logical volume space with SSD drive, something which is quite straight forward on standard Linux distributions (create group of physical partitions and use LVM to define a volume), but I couldn’t succeed in it with Jetson NX neither.

I would be surprising if NVIDIA expects industrial users to be able to embed all software on a tiny SD card or 16 Gb eMMC. I’ve been working with many ARM and x86 embedded systems and it was always easy to deploy with an SSD (SATA or PCIe). Maybe NVIDIA experts can suggest something as I would expect them to have brainstormed on this.

Have anyone found a solution for this?

I can confirm that the first method does work on Xavier NX Dev Kit - i made it running just yesterday on my NX.

You need to check and adapt the name of the NVMe device (iirc it is /dev/nvme0n1 instead of /dev/nvme0n1p1)

1 Like

@dkreutz thx for confirming - I’ll give it a try!

Hello,
I’ve found how to mount SSD as rootfs with extlinux.conf APPEND, but in still requires initrd modification (modification of this method).

Main problem: initrd created by JetPack 4.4 has init script, that search for root device first as device name format, then as PARTUUID format. Then only “PARTUUID*”, “mmcblk*”, “sd*”, “nfs” are acepted as legal rootdev string.
init[62…173]:

rootdev=“$(sed -ne 's/.\broot=/dev/([abcdefklmnps0-9])\b./\1/p’ < /proc/cmdline)"
if [ “${rootdev}” == “” ]; then
uuid_regex=‘[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}’
rootdev="$(sed -ne "s/.
\broot=(PARTUUID=${uuid_regex})\b.*/\1/p” < /proc/cmdline)"
fi

if [ “${rootdev}” != “” ]; then
echo “Root device found: ${rootdev}” > /dev/kmsg;
fi
if [[ “${rootdev}” == PARTUUID* ]]; then
-------
elif [[ “${rootdev}” == mmcblk* ]]; then
-------
elif [[ “${rootdev}” == sd* ]]; then
-------
elif [[ “${rootdev}” == “nfs” ]]; then
-------
else
echo “No root-device: Mount failed” > /dev/kmsg;
exec /bin/bash;
fi

Working second method step by step:

  1. Flash device (Xavier AGX or NX (tested on AGX only)) with JetPack 4.4.
  2. Unpack initrd:
    Create directory in user folder. Create there 2 scripts:
    unpack.sh:

#!/bin/bash
gzip -cd …/initrd | cpio -imd

pack.sh:

#!/bin/bash
find . -print0 | cpio --null --quiet -H newc -o | gzip -9 -n > …/initrdtossd

Make them executable. Create folder to unpack and cd there.

sudo mkdir dir_initrdssd
sudo cp /boot/initrd ./
cd dir_initrdssd
sudo …/unpack.sh

  1. Patch init
    Initrd source will be in dir_initrdssd folder. Patch init script with following patch init.patch:initpatch.log (1.4 KB)
    (only .log text files are accepted by forum :( )
    Patch changes priority to PARTUUID over device name and adds "nvme
    " as accepted rootfs name.

  2. Pack back

sudo …/pack.sh

initrdtossd in folder with scripts will be created. Copy this file to /boot

sudo cp …/initrdtossd /boot/

  1. Edit extlinux.conf
    Find PARTUID of nvme partition with future rootfs.

lsblk -o NAME,PARTUUID
Output needed:
nvme0n1
└─nvme0n1p1 XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Open /boot/extlinux/extlinux.conf

sudo gedit /boot/extlinux/extlinux.conf

Add APPEND line to primary boot and create backup boot
Example:

TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrdtossd
APPEND ${cbootargs} root=PARTUUID=XXXXXXXX-XXXX-XXXX-XXXX->XXXXXXXXXXXX quiet

LABEL backup
MENU LABEL backup kernel
LINUX /boot/Image
INITRD /boot/initrd
APPEND ${cbootargs} quiet

  1. DON’T FORGET to copy rootfs to SSD!!!.
  2. Reboot and PROFIT

P.S. In blockquote “[two points]/” changed to “…/”. I don’t know how to fix it.

@crazy_yorick can you give pros and cons for both methods?

Ok.
Methods:

  1. systemd service
    In this case systemd service setssdroot.service runing before local-fs-pre.target is used ( after systemd-remount-fs.service from initrd, if initrd with systemd is used) . So it’s one of the first runing units when system starts up. But, there are parallel targets swap.target, cryptsetup-pre.target , various low-level services. (systemd bootup ) . This service executes script, which switches rootfs with systemctl call /bin/systemctl --no-block switch-root ${CHROOT_PATH}.

Pros:

  • No initrd or extlinux.conf required. So, work with JetPack 4.2, where kernel is located in special partition.

  • After building new kernel, default initrd update workflow is required, no manual modification of initrd (i.e. flash.sh ...).If system doesn’t use initrd, we need only install modules on SSD and eMMC.

  • If /dev/nvme0n1p1 is absent, default rootfs is used, because setssdroot.service will not be executed.

Cons:

  • It’s still hack:) .

  • There are units, executing in parallel with setssdroot.service, including udevd, thus, for some devices modules will be loaded from rootfs on eMMC while others from NVMe. That’s why we need to install same modules on both.

  • I don’t understand why, but we need copy of setssdroot.service and setssdroot.sh on NVMe, otherwise service completes with error (but still switches rootfs).

  1. extlinux.conf APPEND
    In this case APPEND line with new “root=…” parameter is added to extlinux.conf. At kernel loading stage cboot appends this line to kernel cmdline. So cmdline have 2 “root=…” parameters: first - “root=/dev/mmcblk0p1” from device tree for cboot, second - custom, appended with extlinux.conf directive.

Pros:

  • Normal system bootup sequence. Main and backup kernel could be different.

  • All modules are loaded from initrd or rootfs on NVMe only. One needs only to copy new kernel image and it’s initrd to /boot/ directory on eMMC and configure /boot/extlinux/extlinux.conf there. No modules installation for new kernel on eMMC required. (Except when the same kernel image is used as backup).

  • Backup kernel is set by extlinux.conf :

LABEL backup
MENU LABEL backup kernel
LINUX /boot/Image
INITRD /boot/initrd
APPEND ${cbootargs} quiet

It can have it’s own initrd and only it’s modules are installed on eMMC.

Cons:

  • Only JetPack 4.4 now is supported, because cboot with extlinux.conf parsing is required.

  • After building new kernel and updating initrd , init script should be patched manualy in case of default JetPack initrd. According @gtj, Dracut generated initrd works without modification

  • If NVMe is absent, linux is stuck in initrd. To boot from backup kernel and rootfs on eMMC command from debug terminal should be used.

4 Likes

Thanks to @crazy_yorick and our friend at JetsonHacks (GitHub - jetsonhacks/rootOnNVMe: Switch the rootfs to a NVMe SSD on the Jetson Xavier NX and Jetson AGX Xavier),
I was able to seamlessly run provided scripts on a AGX Xavier board today to transfer rootfs on a Crucial P1 500GB M2 NVMe SSD which was available at /dev/nvme0n1p1

2 Likes

Hi everyone,
I was able to use initrd produced by ubuntu for second method ( extlinux.conf APPEND), thus removing manual manipulations with initrd.
Steps:

  1. Flash device (Xavier AGX or NX (tested on AGX only)) with JetPack 4.4.
  2. Add update-initramfs hook to add xusb firmware to initrd.
    a. Create file tegra-xusbfw with following content (Remove log extention tegra-xusbfw.log (306 Bytes) ):

#!/bin/sh
PREREQ=“”
prereqs()
{
echo “$PREREQ”
}

case $1 in
prereqs)
prereqs
exit 0
;;
esac

. /usr/share/initramfs-tools/hook-functions

copy_exec /lib/firmware/tegra19x_xusb_firmware /lib/firmware
copy_exec /lib/firmware/tegra18x_xusb_firmware /lib/firmware

b. Make file executable and copy to /usr/share/initramfs-tools/hooks directory.
c. Generate initrd:

sudo update-initramfs -c -v -k all

d. Check in log that “tegra19x_xusb_firmware” was added.
e. At this step you should have file initrd.img-4.9.140-tegra in /boot directory.

  1. Edit /boot/extlinux/extlinux.conf

sudo gedit /boot/extlinux/extlinux.conf

Edit INITRD parameter and add APPEND parameter to primary record. Should be something like this (extlinux.conf.log (383 Bytes) ):

TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrd.img-4.9.140-tegra
APPEND ${cbootargs} root=PARTUUID=XXXXXXXX-XXXX-XXXX-XXXX->XXXXXXXXXXXX quiet

LABEL backup
MENU LABEL backup kernel
LINUX /boot/Image
INITRD /boot/initrd
APPEND ${cbootargs} quiet

  1. DON’T FORGET to copy rootfs to SSD!!!.
  2. Reboot

Kernel don’t rises any errors while booting from this initrd.
It would be good if someone from NVIDIA check if ubuntu generated initrd didn’t miss any other modules.

1 Like

It’s very strange that usb firmware is needed to get to an nvme device but if that works, great!

USB firmware is needed because otherwise the usb port will not work.
If you use initrd generated without firmware hook, system do will boot, you will see login screen, but without keyboard it’s useless :).

P.S. I will try APPEND parameter combinations later on weekends.

Yeah but what’s that got to do with nvme unless you’re using a usb<>nvme bridge. I may have gotten lost between this thread and the one on the NX forum. Are you using usb<>nvme or pcie<>nvme?

I use NVMe in M.2 key M slot (PCIe x4).
All above was to differentiate 2 variants of APPEND in extlinux.conf method (2)

2.1 With initrd, installed while flashing with JetPack 4.4.
This case requares patching init script in initrd, as default init script prioritirizes root=/dev/[somedevice] over root=PARTUUID=.... .

With default init APPEND below doesn’t work for some still unknown reason. (Boot stops at initrd’s console, as if there is no device, but I see /dev/nvme0n1p1 there ???)


INITRD /boot/initrd
APPEND ${cbootargs} root=/dev/nvme0n1p1

In case

INITRD /boot/initrd
APPEND ${cbootargs} root=PARTUUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

first root=/dev/mmcblk0p1 is prioritirized and system boots to rootfs on eMMC.

2.2 With initrd generated by update-initramfs in ubuntu.
In this case Xavier is flashed with JetPack 4.4, then new initrd is generated on Xavier itself and extlinux.conf edited to point on new initrd and APPEND root=PARTUUID= added.


INITRD /boot/initrd.img-4.9.140-tegra
APPEND ${cbootargs} root=PARTUUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

This initrd lacks xusb firmware, but has no problems with parsing root=xxx parameter. So linux boots to rootfs on NVMe well, but USB ports are not functional, so no mouse or keyboard could be used.
To add xusb firmware, hook is registered (this post) before update-initramfs.
Thus 2.2 method is most traditional from Linux view, IMHO.

Ah OK, that makes sense. The usb firmware wasn’t needed to make the nvme work, but to make the mouse and keyboard work. Sorry. I was getting confused…

My method,use sdkmanager

on jetson xavier
init nvme ssd and read partuuid

sudo parted /dev/nvme0n1
mklabel gpt
mkpart primary 2048s 100%
quit

sudo mkfs.ext4 /dev/nvme0n1p1
sudo blkid /dev/nvme0n1p1

example my device partuuid
/dev/nvme0n1p1: UUID=“b11f5460-ec67-4f4a-9c41-8cffd4b11df4” TYPE=“ext4” PARTLABEL=“primary” PARTUUID=“532ead91-c15f-4412-83b5-e5675ff21773”

clone emmc to ssd
sudo dd if=/dev/mmcblk0p1 of=/dev/nvme0n1p1

back to linux host

echo ‘532ead91-c15f-4412-83b5-e5675ff21773’ > bootloader/l4t-rootfs-uuid.txt
sudo ./flash.sh jetson-xavier external

on jetson xavier
resize ssd size

sudo resize2fs /dev/nvme0n1p1

upgrade
sudo mount /dev/mmcblk0p1 /mnt
cp -r /boot/* /mnt/

4 Likes

Thanks, @jocover . I have repeated your method. It works great and doesn’t requires any system modifications, unlike APPEND methods. IMHO, it’s the best method in cases where restoration system on eMMC is not required.

I think it should be noted that after sudo ./flash.sh jetson-xavier external all data on eMMC will be rewrited and APP partition consists only boot folder:

./
├── [4.0K] boot
│ ├── [4.0K] dtb
│ │ ├── [269K] tegra194-p2888-0001-p2822-0000.dtb
│ │ └── [4.0K] tegra194-p2888-0001-p2822-0000.dtb.sig
│ ├── [4.0K] extlinux
│ │ └── [ 733] extlinux.conf
│ ├── [ 33M] Image
│ ├── [5.3M] initrd
│ └── [269K] tegra194-p2888-0001-p2822-0000.dtb
└── [ 16K] lost+found [error opening dir]
4 directories, 6 files

Some remarks about kernel command line and initrd.
In @jocover case:

Kernel command line: root=PARTUUID=[MY-PARTUUID] rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 rootfstype=ext4 video=tegrafb no_console_suspend=1 earlycon=tegra_comb_uart,mmio32,0x0c168000 gpt tegra_fbmem=0x800000@0xa069c000 lut_mem=0x2008@0xa0697000 usbcore.old_scheme_first=1 tegraid=19.1.2.0.0 maxcpus=8 boot.slot_suffix= boot.ratchetvalues=0.4.2 vpr_resize sdhci_tegra.en_boot_part_access=1 quiet

First root= is from cboot. Now it’s allready in root=PARTUUID= format and for original initrd APPEND ${cbootargs} root=/dev/mmcblk0p1 in extlinux.conf should enable to load rootfs from eMMC (that must be copied there manualy).

About original initrd. It’s main feature - it doesn’t contain any modules, only libs and firmware, so it works with modified kernels ( original dmesg.orig.log (75.6 KB) , build on Xavier (added KVM hw support like there) dmesg.orig-exp2.log (75.9 KB) ):
ls-initrd.orig.log (7.6 KB)

./

├── [4.0K] lib
│ ├── [4.0K] aarch64-linux-gnu
│ │ ├── [123K] ld-2.23.so

│ │ └── [ 18K] libuuid.so.1.3.0
│ ├── [4.0K] firmware
│ │ ├── [122K] tegra18x_xusb_firmware
│ │ └── [122K] tegra19x_xusb_firmware
│ └── [ 28] ld-linux-aarch64.so.1 → aarch64-linux-gnu/ld-2.23.so
├── [4.0K] mnt

22 directories, 137 files

I also have tested with initrd generated by update-initramfs (with xusbfw hook).
Original kernel work fine with initrd generated for it.
Builded on Xavier kernel with it’s initrd failed to boot. Cboot failed to load initrd. I will create new topic for this problem later. initrd-ubuntu-exp2-cutecom.log (23.5 KB)
But modified kernel booted with update-initramfs generated initrd without any taunted modules (dmesg.ubuntu-exp2tgr.log (75.8 KB) ).
Main difference of generated initrd - it’s size. ls-initrd.ubuntu.log (39.2 KB) ls-initrd.ubuntu-exp2.log (39.3 KB)