...
Get latest source files from git server of SP7021 (2. HOW TO GET SOURCE FILE AND PACKAGE). Refer to report of ll command for the contents of top folder of source of SP7021:
Code Block |
---|
wellslu@scdiu3wells@wells-linux:~/q628/sdc$ ll total 52 drwxr-xrdrwxrwxr-x 12 wellsluwells spwells 4096 OctDec 155 1200:0842 ./ drwxr-xrdrwxrwxr-x 1912 wellsluwells spwells 4096 Oct 1516 1223:0301 ../ drwxrdrwxrwxr-xr-x 8 wellsluwells spwells 4096 Jun May 267 1719:2959 boot/ drwxrdrwxrwxr-xr-xx 4 wellsluwells spwells 4096 AugNov 2520 1723:1710 build/ drwxr-xrdrwxrwxr-x 7 wellsluwells spwells 4096 AugJul 1927 1118:4553 crossgcc/ drwxrdrwxrwxr-xr-x 6 wellsluwells spwells 4096 SepJun 97 19:59 2019 eCos/ drwxr-xrdrwxrwxr-x 9 wellsluwells spwells 4096 Jun 15 5 1921:1052 freertos/ drwxrdrwxrwxr-xr-x 8 wellsluwells spwells 4096 AugDec 194 1123:4502 ipack/ drwxrdrwxrwxr-xr-x 7 wellsluwells spwells 4096 SepJun 9 20197 19:59 linux/ -r--r--r-- 1 wellsluwells spwells 23 SepJun 9 20197 19:59 Makefile drwxrdrwxrwxr-xr-x 4 wellsluwells spwells 4096 SepJun 97 19:59 2019 nonos/ drwxrdrwxrwxr-xr-x 7 wellsluwells spwells 4096 SepJun 97 19:59 2019 .repo/ drwxrdrwxrwxr-xr-x 3 wellsluwells spwells 4096 Jun 2927 1016:4334 yocto/ |
2. Configure environment
Get latest source files of SP7021 from git server of SP7021 (2. HOW TO GET SOURCE FILE AND PACKAGE) and run make config command on top folder. After configuration menu pops up, first, choose board you want to build image for. For example, press 4 for SP7021 Demo Board (V3). Second, press 2 to choose to build image for SD card and then enter to start to configure building environment. Refer to screenshot below,:
...
make config is starting to configure building environment. It takes 1~2 minutes to complete.
...
Run make all command to start to create image for SD card. It might take several minutes to complete. After 'make all' completes, you will see screen like:
...
From information on screenscreenshot, two partitions are created in the image of SD card. The first partition starts at sector 2048 2,048 and ends at sector 206847264,191. Its size is 100 128 MiB and file-system is W95 FATFAT32. The second partition starts at sector 206848 264,192 and ends at sector 239615299,007. Its size is 16 17 MiB and file-system is Linux (ext3ext4).
4. Image files
The built image files are stored at out/boot2linux_SDcard/. Refer to screenshot of list of the folder:
...
DIP-SW is set to ON-ON. Refer to Selection of boot devices of SP7021 (Plus1) for details of boot selection.
...
At the first time, Linux boots from a new SD card. The built-in script of Linux will run fdisk command to extend the size of rootfs partition to the end of SD card and then re-boot. Refer to log while Linux script is extending size of rootfs partition:
Code Block |
---|
[ 1.706696777157] EXT4-fs (mmcblk1p2): mountingmounted ext3filesystem filewith systemordered usingdata themode. ext4 subsystemOpts: (null) [ 1.793441777419] EXT4-fs (mmcblk1p2)VFS: mounted filesystem with ordered data mode. Opts: (null) [ 1.793709] VFS: Mounted Mounted root (ext3ext4 filesystem) on device 179:218. [ 1.797172781035] devtmpfs: mounted [ 1.801289785128] Freeing unused kernel memory: 1024K [ 1.816633854989] Run /sbin/init as init process /etc/init.d/rcS starts... Mounting other filesystems ... rc.extra [bg] sdcard boot set... partition set 0x00009BBA0x0000A52E totalsize=15836643328 0x00000007 extra done totalsize=30930936 startsector=206848264192 The number of cylinders for this disk is set to 483296. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): Disk /dev/mmcblk1: 15 GB, 15836643328 bytes, 30930944 sectors 483296 cylinders, 4 heads, 16 sectors/track Units: sectors of 1 * 512 = 512 bytes Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type /dev/mmcblk1p1 0,32,33 1216,223113,1933 2048 206847264191 204800262144 100M128M b Win95 FAT32 /dev/mmcblk1p2 1216,223113,2034 1518,156,10,59 264192 206848 299007 241663 34816 17.0M 83 Linux Command (m for help): Partition number (1-4): Command (m for help): Partition type p primary partition (1-4) e extended Partition number (1-4): First sector (16-30930943, default 16): Last sector or +size{,K,M,G,T} (206848264192-30930943, default 30930943): Command (m for help): Disk /dev/mmcblk1: 15 GB, 15836643328 bytes, 30930944 sectors 483296 cylinders, 4 heads, 16 sectors/track Units: sectors of 1 * 512 = 512 bytes Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type /dev/mmcblk1p1 0,32,33 1216,223113,1933 2048 206847264191 204800262144 100M128M b Win95 FAT32 /dev/mmcblk1p2 1023,3,16 1023,3,16 206848264192 30930936 3072408930666745 14.6G 83 Linux Command (m for help): The partition table has been altered. Calling ioctl() to re-read partition table fdisk: WARNING: rereading partition table failed, kernel still uses old table: Device or resource busy End of /etc/init.d/rcS [ 3.396729832704] EXT4-fs (mmcblk1p2): re-mounted. Opts: (null) The system is going down NOW! Sent SIGTERM to all processes Sent SIGKILL to all processes Requesting system reboot [ 8.317512555816] reboot: Restarting system sp_restart +++iBoot v1.02 Jan 10 2019 11:20:28 -- B -- [d] iboot.c :96 |
The latest command in the script is reboot command. You’ll see system re-boot boots after script completes extending size of rootfs partition.
After system re-boots successfully, built-in script of Linux will run resize2fs to resize the root file-system to make use of the whole partition (It was extended in previous step.). It takes a while for completing resizing rootfs. Refer to log when resizing:
Code Block |
---|
[ 1.737678715502] EXT4-fs (mmcblk1p2): mountingmounted ext3filesystem filewith systemordered usingdata themode. ext4 subsystemOpts: (null) [ 1.752778715821] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null) [ 1.753050] VFS: VFS: Mounted root (ext3ext4 filesystem) on device 179:262. [ 1.756553720053] devtmpfs: mounted [ 1.760744723384] Freeing unused kernel memory: 1024K [ 1.879524755834] Run /sbin/init as init process /etc/init.d/rcS starts... Mounting other filesystems ... rc.extra [bg] sdcard boot set... resize2fs partition 0x0000B37D0x00008715 0x00000007 extra done Filesystem at /dev/mmcblk1p2 is mounted on /; on-line resizing required [ 2.221203] EXT4-fs (mmcblk1p2): resizing filesystem from 4352 to 3840511 blocks old_desc_blocks = 1, new_desc_blocks = 1 [ 10.648447] random: crng init done [ 12.290148] EXT4-fs (mmcblk1p2): resized to 1867776 blocks [ 22.952843] EXT4-fs (mmcblk1p2): resized to 2686976 blocksold_desc_blocks = 1, new_desc_blocks = 1 [ 33 2.218081106883] EXT4-fs (mmcblk1p2): resized resizing filesystem from 4352 to 33423363833343 blocks [ 41 2.925326336889] EXT4-fs (mmcblk1p2): resized filesystem to 38405113833343 The filesystem on /dev/mmcblk1p2 is now 38405113833343 (4k) blocks long. Filesystem Size Used Available Use% Mounted on /dev/root 14.6G5G 9.9M8M 14.6G5G 0% / devtmpfs 248.3M 0 248.3M 0% /dev tmpfs 248.8M 0 248.8M 0% /dev/shm tmpfs 248.8M 0 248.8M 0% /tmp End of /etc/init.d/rcS login[711709]: root login on 'console' ~ # |
Resizing has completed. Available size of root file-system is 14.5 GB. You are ready to use SP7021 Linux.
...