Lastlog User Guide
REVISION HISTORY¶
| Revision No. | Description | Date |
|---|---|---|
| 1.0 | 04/27/2024 | |
| 1.1 | 09/12/2025 |
1. Introduction to Lastlog¶
SigmaStar Lastlog is actually the pstore function natively supported by Linux.
pstore was originally used to automatically save logs in the kernel log buffer when an oops or panic occurs in the system. In the current kernel version, it has supported more functions, such as saving console logs, ftrace messages, and user space logs. At the same time, it also supports saving these messages in different storage devices, such as memory, block devices, or mtd devices.
PCUPID currently supports the lastlog function on both spinand and emmc, Comake PI D1 is enabled by default.For other series, if you want to enable this feature, you will need to modify the configuration file and add a pstore partition. The following are the steps to enable the lastlog function on spinand and emmc.
2. Add lastlog function to spinand¶
2.1. Modify Linux configuration¶
Modify the Linux kernel defconfig according to the following configuration and save it after the modification is completed.
make menuconfig # File systems ---> # [*] Miscellaneous filesystems ---> # <M> Persistent store support # <M> DEFLATE (ZLIB) compression # < > LZO compression # < > LZ4 compression # < > LZ4HC compression # [ ] 842 compression # [ ] zstd compression # Default pstore compression algorithm (deflate) ---> # [*] Log kernel console messages # [*] Log user space messages # < > Log panic/oops to a RAM buffer # [*] Record order by counter instead of timestamp. # <M> Log panic/oops to a block device # () block device identifierntifier # (64) Size in Kbytes of kmsg dump log to store # (2) Maximum kmsg dump reason to store store # (64) Size in Kbytes of pmsg to store # (64) Size in Kbytes of console log to store # Device Drivers ---> # <*> Memory Technology Device (MTD) support ---> # <M> Log panic/oops to an MTD buffer based on pstore # Kernel hacking ---> # Generic Kernel Debugging Instruments ---> # [*] Magic SysRq key # (0x1) Enable magic SysRq key functions by default # [*] Enable magic SysRq key over serial # () Char sequence that enables magic SysRq over serial
2.2. Modify project defconfig¶
Add a new configuration in defconfig in the project: CONFIG_PSTORE=y, so that pstore-related commands will be automatically executed when packaging the image.
2.3. Add pstore partition in the partition configuration file¶
-
Modify IMAGE_LIST
IMAGE_LIST = cis boot kernel rootfs misc pstore ubia miservice customer
-
Modify cis$(SYSTAB)
cis$(SYSTAB) = $(env$(MTDPART)),$(kernel$(MTDPART)),$(rootfs$(MTDPART)),$(vendor_storage$(MTDPART)),$(misc$(MTDPART)),$(pstore$(MTDPART)),$(ubia$(MTDPART))
-
Added pstore partition

2.4. Regenerate the image¶
Execute the following command in the project directory to regenerate the image file:
make xxx_defconfig make clean -j32 make image -j32
3. Add lastlog function on emmc¶
3.1. Modify Linux configuration¶
Modify the Linux kernel defconfig according to the following configuration and save it after the modification is completed.
make menuconfig # File systems ---> # [*] Miscellaneous filesystems ---> # <*> Persistent store support # < > DEFLATE (ZLIB) compression # < > LZO compression # < > LZ4 compression # < > LZ4HC compression # [ ] 842 compression # [ ] zstd compression # [*] Log kernel console messages # [*] Log user space messages # < > Log panic/oops to a RAM buffer # [*] Record order by counter instead of timestamp. # -*- Log panic/oops to a block device # () block device identifierntifier # (64) Size in Kbytes of kmsg dump log to store # (2) Maximum kmsg dump reason to store store # (64) Size in Kbytes of pmsg to store # (64) Size in Kbytes of console log to store # Kernel hacking ---> # Generic Kernel Debugging Instruments ---> # [*] Magic SysRq key # (0x1) Enable magic SysRq key functions by default # [*] Enable magic SysRq key over serial # () Char sequence that enables magic SysRq over serial
3.2. Modify project defconfig¶
Add a new configuration in defconfig in the project: CONFIG_PSTORE=y, so that pstore-related commands will be automatically executed when packaging the image.
3.3. Add pstore partition in the partition configuration file¶
-
Modify IMAGE_LIST
IMAGE_LIST = boot kernel rootfs misc miservice pstore customer
-
Added pstore partition

3.4. Regenerate the image¶
Execute the following command in the project directory to regenerate the image file:
make xxx_defconfig make clean -j32 make image -j32
4. Verify lastlog functionality¶
-
Generate console log after reboot
After the burning is complete, boot to the Linux command line and then reboot Linux. You can see that after Linux restarts, the pstore module generates the console-pstore_blk-0 file, and its content is the Linux dmesg log. This file will be regenerated every time Linux reboots.

-
panic/oops log generation
Enter
echo c > /proc/sysrq-triggerto manually trigger panic. After restarting Linux, you can see that the pstore module generates the console-pstore_blk-0 file and the dmesg-pstore_blk-0 file. The dmesg-pstore_blk-0 file contains complete panic information. The dmesg-pstore_blk-0 file is only generated when the system panics or oops.
-
pmsg generates log
pmsg is a pstore object accessible to user space. Users can write data to
/dev/pmsg0. After Linux restarts, the pstore module will generate the pmsg-pstore_blk-0 file, which stores the content written by the user before Linux restarts.
5. Dump pstore Log Data¶
When Linux fails, you can dump the Linux log data from the pstore partition to assist with debugging. The following are the steps to dump the data:
Step 1. Determine the location of the pstore partition in eMMC. You can check this by executing the "mmc part" command in U-Boot:

The above figure shows that the starting address of the pstore partition in emmc is 1061888 and the partition size is 2MB.
Step 2. Use Flash Tool to dump the pstore partition data to the local PC:
Please note: Before dumping, you must first close the SoC serial port (type "debug" and press Enter in U-Boot, type "11111" in Linux), and disconnect the PC terminal connection (Xshell/MobaXterm).

The successful dump interface is shown below:

After the dump is successful, the data will be saved in the EMMC_DATA_UDA.bin file in the Flash Tool directory.
Step 3. Use the "strings" command to convert the data into a text file:
strings EMMC_DATA_UDA.bin > log.txt