Step 7 : Post Build Checks ============================== .. tab-set:: .. tab-item:: Post Build Checks * In this program, you are going to learn .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * How to ? .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow Topics in this section, * :ref:`Post Build Checks ` .. _openwrt_rpi_4b_step7_0: .. tab-set:: .. tab-item:: Check Linux kernel .config file .. code-block:: c $ cd $HOME/openwrt/build_dir/target-aarch64_cortex-a72_musl/linux-bcm27xx_bcm2711/linux-6.1.69 $ cat .config .. dropdown:: See the full output below .. Literalinclude:: linux_config.txt .. tab-set:: .. tab-item:: Check the location of toolchain .. code-block:: c $ cd $HOME/openwrt/staging_dir/toolchain-aarch64_cortex-a72_gcc-12.3.0_musl/aarch64-openwrt-linux-musl/bin $ ls -l bin -rwxr-xr-x 2 test 2226840 Dec 23 02:58 ar -rwxr-xr-x 2 test 3467944 Dec 23 02:58 as -rwxr-xr-x 4 test 4025768 Dec 23 02:58 ld -rwxr-xr-x 4 test 4025768 Dec 23 02:58 ld.bfd -rwxr-xr-x 2 test 2217128 Dec 23 02:58 nm -rwxr-xr-x 2 test 2353136 Dec 23 02:58 objcopy -rwxr-xr-x 2 test 3870336 Dec 23 02:58 objdump -rwxr-xr-x 2 test 2226872 Dec 23 02:58 ranlib -rwxr-xr-x 2 test 1284528 Dec 23 02:58 readelf -rwxr-xr-x 2 test 2353136 Dec 23 02:58 strip .. tab-set:: .. tab-item:: Explanation for "ar" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * ar: Create, Modify, and Extract from archives .. dropdown:: see the options supported by "ar" tool .. Literalinclude:: ar.txt .. tab-set:: .. tab-item:: Explanation for "as" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * as: The portable GNU assembler .. dropdown:: see the options supported by "as" tool .. Literalinclude:: as.txt .. tab-set:: .. tab-item:: Explanation for "ld" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * ld: The GNU linker .. tab-set:: .. tab-item:: Explanation for "ld.bfd" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * ld.bfd: The linker accesses object and archive files using the BFD (Binary File Descriptor) libraries. .. tab-set:: .. tab-item:: Explanation for "nm" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * nm: List symbols from object files .. dropdown:: see the options supported by "nm" tool .. Literalinclude:: nm.txt .. tab-set:: .. tab-item:: Explanation for "objcopy" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * objcopy: Copy and translate object files .. dropdown:: see the options supported by "objcopy" tool .. Literalinclude:: objcopy.txt .. tab-set:: .. tab-item:: Explanation for "objdump" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * objdump: Display information from object files .. dropdown:: see the options supported by "objdump" tool .. Literalinclude:: objdump.txt .. tab-set:: .. tab-item:: Explanation for "ranlib" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * ranlib: Generate an index to an archive .. dropdown:: see the options supported by "ranlib" tool .. Literalinclude:: ranlib.txt .. tab-set:: .. tab-item:: Explanation for "readelf" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * readelf: Display information about ELF (Executable and Linkable Format) files .. dropdown:: see the options supported by "readelf" tool .. Literalinclude:: readelf.txt .. tab-set:: .. tab-item:: Explanation for "strip" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * strip: Discard symbols and other data from object files .. dropdown:: see the options supported by "strip" tool .. Literalinclude:: strip.txt .. tab-set:: .. tab-item:: Check location of the full image * Make sure the current directory is "openwrt" .. code-block:: c $ pwd $HOME/openwrt/bin/targets/bcm27xx/bcm2711 $ ls -l -rw-r--r-- 1 test 1652 Jan 16 14:18 config.buildinfo -rw-r--r-- 1 test 83 Jan 16 14:18 feeds.buildinfo -rw-r--r-- 1 test 17117078 Jan 16 14:20 openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz -rw-r--r-- 1 test 17117925 Jan 16 14:20 openwrt-bcm27xx-bcm2711-rpi-4-ext4-sysupgrade.img.gz -rw-r--r-- 1 test 4207 Jan 16 14:20 openwrt-bcm27xx-bcm2711-rpi-4.manifest -rw-r--r-- 1 test 15350996 Jan 16 14:20 openwrt-bcm27xx-bcm2711-rpi-4-squashfs-factory.img.gz -rw-r--r-- 1 test 15351843 Jan 16 14:20 openwrt-bcm27xx-bcm2711-rpi-4-squashfs-sysupgrade.img.gz drwxr-xr-x 2 test 4096 Jan 16 14:20 packages -rw-r--r-- 1 test 2141 Jan 16 14:20 profiles.json -rw-r--r-- 1 test 912 Jan 16 14:20 sha256sums -rw-r--r-- 1 test 18 Jan 16 14:20 version.buildinfo .. tab-set:: .. tab-item:: Explanation for "config.buildinfo" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * config.buildinfo: Creating a config from .config backup or config.buildinfo .. tab-set:: .. tab-item:: Explanation for "feeds.buildinfo" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * feeds.buildinfo: Collection of packages. .. tab-set:: .. tab-item:: Explanation for "openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz: In this openwrt image is built .. tab-set:: .. tab-item:: Explanation for "openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz: In this openwrt image is built * ext4: This firmware contains a regular ext4 Linux partition * factory: Use when flashing * img: image file * gz: extension for gzip .. tab-set:: .. tab-item:: Explanation for "openwrt-bcm27xx-bcm2711-rpi-4-ext4-sysupgrade.img.gz" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * sysupgrade: sysupgrade is designed to be flashed from OpenWrt/LEDE itself .. tab-set:: .. tab-item:: Explanation for "openwrt-bcm27xx-bcm2711-rpi-4.manifest" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * manifest: .. tab-set:: .. tab-item:: Explanation for "openwrt-bcm27xx-bcm2711-rpi-4-squashfs-factory.img.gz" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * squashfs: This firmware contains a type of partition that is compressed and mounts read-only .. tab-set:: .. tab-item:: Explanation for "profiles.json" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * profiles.json: A profile is a set of documents with a profile relationship to the profile. * json: JavaScript Object Notation .. tab-set:: .. tab-item:: Explanation for "sha256sums" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * sha256sums: An SHA-256 checksum is a sequence of numbers and letters that you can use to check that your copy of a downloaded update file is identical to the original .. tab-set:: .. tab-item:: Explanation for "version.buildinfo" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * version.buildinfo: It will be version of the openwrt .. tab-set:: .. tab-item:: Check the size of the full image .. code-block:: c $ du -h openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz 17M openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz .. tab-set:: .. tab-item:: Check and inspect the full image * To extract image file following are the commands .. code-block:: c $ pwd $HOME/openwrt/bin/targets/bcm27xx/bcm2711 .. tab-set:: .. tab-item:: Extract openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz * After extracting you will get openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img .. code-block:: c $ gunzip openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz $ ls -l -rw-r--r-- 1 test 1652 Jan 16 19:57 config.buildinfo -rw-r--r-- 1 test 71 Jan 16 19:57 feeds.buildinfo -rw-r--r-- 1 test 184549376 Jan 16 20:02 openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img -rw-r--r-- 1 test 17117911 Jan 16 19:58 openwrt-bcm27xx-bcm2711-rpi-4-ext4-sysupgrade.img.gz -rw-r--r-- 1 test 4207 Jan 16 19:58 openwrt-bcm27xx-bcm2711-rpi-4.manifest -rw-r--r-- 1 test 15351033 Jan 16 19:58 openwrt-bcm27xx-bcm2711-rpi-4-squashfs-factory.img.gz -rw-r--r-- 1 test 15351880 Jan 16 19:58 openwrt-bcm27xx-bcm2711-rpi-4-squashfs-sysupgrade.img.gz drwxr-xr-x 2 test 4096 Jan 16 19:58 packages -rw-r--r-- 1 test 2141 Jan 16 19:59 profiles.json -rw-r--r-- 1 test 912 Jan 16 19:59 sha256sums -rw-r--r-- 1 test 18 Jan 16 19:57 version.buildinfo .. tab-set:: .. tab-item:: Check how many partitions are there in .img file .. code-block:: c $ file openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img: DOS/MBR boot sector; partition 1 : ID=0xc, active, start-CHS (0x20,2,3), end-CHS (0x228,2,34), startsector 8192, 131072 sectors; partition 2 : ID=0x83, start-CHS (0x249,0,37), end-CHS (0x196,1,25), startsector 147456, 212992 sectors * There are 2 partitions are there in .img file .. tab-set:: .. tab-item:: Install kpartx to make partition table * kpartx: Create device maps from partition tables .. code-block:: c $ sudo apt-get install kpartx .. tab-set:: .. tab-item:: To create specific sectors * -a: Add partition mappings * -v: Operate verbosely .. code-block:: c $ sudo kpartx -av openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img add map loop29p1 (253:0): 0 131072 linear 7:29 8192 add map loop29p2 (253:10): 0 212992 linear 7:29 147456 .. tab-set:: .. tab-item:: Create 2 folders to mount the device maps .. code-block:: c $ sudo mkdir -p /mnt/boot $ sudo mount /dev/mapper/loop29p1 /mnt/boot $ sudo mkdir -p /mnt/root $ sudo mount /dev/mapper/loop29p2 /mnt/root .. tab-set:: .. tab-item:: Check contents in /mnt/boot and /mnt/root .. code-block:: c $ ls -l /mnt/boot -rwxr-xr-x 1 root root 54477 Dec 21 15:56 bcm2711-rpi-400.dtb -rwxr-xr-x 1 root root 54388 Dec 21 15:56 bcm2711-rpi-4-b.dtb -rwxr-xr-x 1 root root 54997 Dec 21 15:56 bcm2711-rpi-cm4.dtb -rwxr-xr-x 1 root root 90 Dec 21 15:56 cmdline.txt -rwxr-xr-x 1 root root 581 Dec 21 15:56 config.txt -rwxr-xr-x 1 root root 496 Dec 21 15:56 COPYING.linux -rwxr-xr-x 1 root root 638 Dec 21 15:56 distroconfig.txt -rwxr-xr-x 1 root root 3171 Dec 21 15:56 fixup4cd.dat -rwxr-xr-x 1 root root 5394 Dec 21 15:56 fixup4.dat -rwxr-xr-x 1 root root 8378 Dec 21 15:56 fixup4x.dat -rwxr-xr-x 1 root root 12068872 Dec 21 15:56 kernel8.img -rwxr-xr-x 1 root root 1594 Dec 21 15:56 LICENCE.broadcom drwxr-xr-x 2 root root 24576 Dec 21 15:56 overlays -rwxr-xr-x 1 root root 803644 Dec 21 15:56 start4cd.elf -rwxr-xr-x 1 root root 2248864 Dec 21 15:56 start4.elf -rwxr-xr-x 1 root root 2996328 Dec 21 15:56 start4x.elf $ ls -l /mnt/root drwxr-xr-x 2 root root 4096 Dec 21 15:56 bin drwxr-xr-x 2 root root 4096 Dec 21 15:56 dev drwxr-xr-x 23 root root 4096 Dec 21 15:56 etc drwxr-xr-x 11 root root 4096 Dec 21 15:56 lib lrwxrwxrwx 1 root root 3 Dec 21 15:56 lib64 -> lib drwx------ 2 root root 4096 Jan 1 1970 lost+found drwxr-xr-x 2 root root 4096 Dec 21 15:56 mnt drwxr-xr-x 2 root root 4096 Dec 21 15:56 overlay drwxr-xr-x 2 root root 4096 Dec 21 15:56 proc drwxrwxr-x 2 root root 4096 Dec 21 15:56 rom drwxr-x--- 2 root root 4096 Dec 21 15:56 root drwxr-xr-x 2 root root 4096 Dec 21 15:56 sbin drwxr-xr-x 2 root root 4096 Dec 21 15:56 sys drwxrwxrwt 2 root root 4096 Dec 21 15:56 tmp drwxr-xr-x 7 root root 4096 Dec 21 15:56 usr lrwxrwxrwx 1 root root 3 Dec 21 15:56 var -> tmp drwxr-xr-x 2 root root 4096 Dec 21 15:56 www .. tab-set:: .. tab-item:: Do umount for /mnt/boot and /mnt/root .. code-block:: c $ umount /mnt/boot $ umount /mnt/root .. tab-set:: .. tab-item:: Check space acquired on RAM * using meminfo command we can check the space acquired on the RAM. .. code-block:: shell root@OpenWrt:/# cat /proc/meminfo .. dropdown:: See the full output below .. literalinclude:: meminfo.txt .. tab-set:: .. tab-item:: Check space acquired on flash. * using df command we can interpret the space acquire on the flash. .. code-block:: shell root@OpenWrt:/# df -h Filesystem Size Used Available Use% Mounted on /dev/root 102.3M 30.1M 70.1M 30% / tmpfs 458.3M 140.0K 458.2M 0% /tmp /dev/mmcblk0p1 63.9M 20.1M 43.7M 32% /boot tmpfs 512.0K 0 512.0K 0% /dev * this needs to be correlated with the mount command output since this df also lists out virtual filesystem. .. code-block:: shell root@OpenWrt:/# mount .. dropdown:: See the full output below .. literalinclude:: mount2.txt * from verifying this two outputs we can come to the following conclusion. * /dev/mmcblk0p1 is mounted to /boot. * /dev/root is mounted on / * this two filesystem comprises of the space acquired on flash. .. tab-set:: .. tab-item:: Check the build ID .. code-block:: shell root@OpenWrt:/# cat /etc/os-release | grep BUILD_ID BUILD_ID="r24685-4a2ff73177" .. tab-set:: .. tab-item:: Check the linux kernel version * Check the linux kernel version using the following command .. code-block:: shell root@OpenWrt:/# uname -a Linux OpenWrt 6.1.69 #0 SMP Thu Dec 21 10:26:35 2023 aarch64 GNU/Linux .. tab-set:: .. tab-item:: Check the openwrt version * Check the openwrt version using the following command .. code-block:: shell root@OpenWrt:/# cat /etc/openwrt_release DISTRIB_ID="OpenWrt" DISTRIB_RELEASE="SNAPSHOT" DISTRIB_REVISION="r24685-4a2ff73177" DISTRIB_TARGET="bcm27xx/bcm2711" DISTRIB_ARCH="aarch64_cortex-a72" DISTRIB_DESCRIPTION="OpenWrt SNAPSHOT r24685-4a2ff73177" DISTRIB_TAINTS="no-all override" .. tab-set:: .. tab-item:: Check list of drivers loaded in RAM .. code-block:: shell root@OpenWrt:/# lsmod .. dropdown:: See the output below .. Literalinclude:: ls_mod.txt .. tab-set:: .. tab-item:: Check list of drivers present in root partition .. code-block:: shell root@OpenWrt:/# find / -iname "*.ko" .. dropdown:: See the output below .. Literalinclude:: ko.txt .. tab-set:: .. tab-item:: Check the list of libraries loaded .. code-block:: shell root@OpenWrt:/# find / -iname "*.so" .. dropdown:: See the output below .. Literalinclude:: so.txt .. code-block:: shell root@OpenWrt:/# find / -iname "*.a" .. dropdown:: See the output below * Static library files not found .. Literalinclude:: lib3.txt .. tab-set:: .. tab-item:: Check the list of applications loaded .. code-block:: shell root@OpenWrt:/# find /usr/bin .. dropdown:: See the output below .. Literalinclude:: app1.txt .. code-block:: shell root@OpenWrt:/# find /usr/sbin .. dropdown:: See the output below .. Literalinclude:: app2.txt .. code-block:: shell root@OpenWrt:/# cd bin .. dropdown:: See the output below .. Literalinclude:: bin.txt .. code-block:: shell root@OpenWrt:/# cd sbin .. dropdown:: See the output below .. Literalinclude:: sbin.txt .. tab-set:: .. tab-item:: Check list of all threads * ps: Displays information about a selection of the active processes .. code-block:: shell root@OpenWrt:/# ps .. dropdown:: See the output below .. Literalinclude:: threads.txt .. tab-set:: .. tab-item:: Check list of System threads * TODO .. code-block:: c .. tab-set:: .. tab-item:: Check list of Driver threads * TODO .. code-block:: c .. tab-set:: .. tab-item:: Check list of Application threads * TODO .. code-block:: c .. tab-set:: .. tab-item:: Check CPU usage of all threads .. code-block:: shell root@OpenWrt:/# top .. dropdown:: See the full output below .. Literalinclude:: top1.txt .. tab-set:: .. tab-item:: Check RAM usage of all threads * TODO .. code-block:: c .. tab-set:: .. tab-item:: Check list of mounted partitions using "mount" .. code-block:: shell root@OpenWrt:/# mount .. dropdown:: See the full output below .. Literalinclude:: mount1.txt .. tab-set:: .. tab-item:: Check list of all physical partitions using "fdisk -l" .. code-block:: shell root@OpenWrt:/# fdisk -l .. dropdown:: See the full output below .. Literalinclude:: fdisk_brd.txt .. tab-set:: .. tab-item:: Step 7.5.5: Check overall RAM usage * In this section, we will know RAM usage .. code-block:: shell root@OpenWrt:/# free total used free shared buff/cache available Mem: 3892552 43880 3830560 140 18112 3803272 Swap: 0 0 0 .. tab-set:: .. tab-item:: Check list of all Network interfaces .. code-block:: shell root@OpenWrt:/# ifconfig -a br-lan Link encap:Ethernet HWaddr E4:5F:01:3C:F4:21 inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fddb:1aa5:ff14::1/60 Scope:Global UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) eth0 Link encap:Ethernet HWaddr E4:5F:01:3C:F4:21 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:320 errors:0 dropped:0 overruns:0 frame:0 TX packets:320 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:24960 (24.3 KiB) TX bytes:24960 (24.3 KiB) wlan0 Link encap:Ethernet HWaddr E4:5F:01:3C:F4:22 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) .. tab-set:: .. tab-item:: Check list of all Wireless interfaces using "iw dev" .. code-block:: shell root@OpenWrt:/# iw dev phy#0 Interface wlan0 ifindex 3 wdev 0x1 addr e4:5f:01:3c:f4:22 type managed channel 34 (5170 MHz), width: 20 MHz, center1: 5170 MHz .. tab-set:: .. tab-item:: Check list of all Wireless interfaces using "iwconfig" .. code-block:: shell root@OpenWrt:/# iwconfig lo no wireless extensions. eth0 no wireless extensions. wlan0 no wireless extensions. br-lan no wireless extensions. .. dropdown:: See the full output below * iwconfig is not supported in this RPI 4b version .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow What is /.bashrc file? .. dropdown:: See Answer * ??