in Embedded, IOT, Linux

Embedded Linux S3C2440 – Partitions an FileSytem (YAFFS2)

Summary

Tested embedded Linux S3C2440 for partitions and YAFFS2 FileSystem with successful result. Embedded Linux S3C2440 booted up on Linux kernel with YAFFS2 FileSystem support and root_yaffs root file image downloaded to a partition of NAND flash.

S3C2440 NAND flash 4 partition

The NAND flash of S3C2440 board has been divided into 4 partitions. The partition table in Bootloader is consistent with the default machine configuration of the board as below,

Name Offset Size
vivi "u-boot" 0x000000000000 0x000000040000
param "u-boot-env" 0x000000040000 0x000000020000
"kernel" 0x000000060000 0x000000660000
"root" 0x000000660000 0x00003fa80000

Type q at bootloader menu to enter vivi shell, to use part show to show partition table.

##### FriendlyARM BIOS 2.0 for 2440 #####
[x] format NAND FLASH for Linux
[v] Download vivi 
[k] Download linux kernel 
[y] Download root_yaffs image 
[a] Absolute User Application
[n] Download Nboot for WinCE 
[l] Download WinCE boot-logo
[w] Download WinCE NK.bin 
[d] Download & Run 
[z] Download zImage into RAM 
[g] Boot linux from RAM 
[f] Format the nand flash 
[b] Boot the system 
[s] Set the boot parameters 
[u] Backup NAND Flash to HOST through USB(upload) 
[r] Restore NAND Flash from HOST through USB 
[q] Goto shell of vivi 
[i] Version: 1026-2K
Enter your selection: q
Supervivi> part show
Number of partitions: 4
name            :       offset          size            flag
------------------------------------------------------------
vivi            :       0x00000000      0x00040000      0
param           :       0x00040000      0x00020000      0
kernel          :       0x00060000      0x00600000      0
root            :       0x00660000      0x3fa80000      0
Supervivi> 

The default partitions of the NAND flash is hard coded in file arch/arm/mach-s3c24xx/mach-mini2440.c, as shown below,

/* NAND Flash on MINI2440 board */

static struct mtd_partition mini2440_default_nand_part[] __initdata = {
    [0] = {
        .name   = "u-boot",
        .size   = SZ_256K,
        .offset = 0,
    },
    [1] = {
        .name   = "u-boot-env",
        .size   = SZ_128K,
        .offset = SZ_256K,
    },
    [2] = {
        .name   = "kernel",
        /* 5 megabytes, for a kernel with no modules
         * or a uImage with a ramdisk attached */
        .size   = 0x00600000,
        .offset = SZ_256K + SZ_128K,
    },
    [3] = {
        .name   = "root",
        .offset = SZ_256K + SZ_128K + 0x00600000,
        .size   = MTDPART_SIZ_FULL,
    },
};

The first partition "u-boot" is used to store the bootloader.
The second partition is used to store parameters of bootloader.
The third partition is used to store kernel.
The fourth partition is used to store the root file system.
The bootloader supports YAFFS2 file system.

Patch the Linux Kernel to support YAFFS2

The source code of YAFFS2 is in the folder /home/iot/mini2440/rootfilesystem/yaffs2-4e188b0, patch the linux kernel.

[root@localhost yaffs2-4e188b0]# pwd
/home/iot/mini2440/rootfilesystem/yaffs2-4e188b0
[root@localhost yaffs2-4e188b0]# ./patch-ker.sh c m /home/iot/mini2440/linux-3.8.7/
Updating /home/iot/mini2440/linux-3.8.7//fs/Kconfig
Updating /home/iot/mini2440/linux-3.8.7//fs/Makefile
[root@localhost yaffs2-4e188b0]#

Start the Linux kernel configuration editor.

[root@localhost yaffs2-4e188b0]# cd /home/iot/mini2440/linux-3.8.7/
[root@localhost linux-3.8.7]# pwd
/home/iot/mini2440/linux-3.8.7
[root@localhost linux-3.8.7]# make menuconfig

Navigate to File system -> Miscellaneous filesystem --->, select yaffs2 file system support,

<*>   yaffs2 file system support

Navigate to General Setup, and scroll down to [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support, the deselect this line.

[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support                                                          x x
  x x                                                      (initramfs.cpio) Initramfs source file(s)

Change to:

[ ] Initial RAM filesystem and RAM disk (initramfs/initrd) support
Do you wish to save your new configuration ? <ESC><ESC> to continue.
  < Yes >      <  No  >

make clean and compile the kernel and download it to S3C2440 board later, note this zImage will exclude the initramfs.cpio file, and the size of zImage will be much smaller.

[root@localhost linux-3.8.7]# make clean
  CLEAN   .
  CLEAN   arch/arm/kernel
  CLEAN   drivers/tty/vt
  CLEAN   drivers/video/logo
  CLEAN   kernel
  CLEAN   lib
  CLEAN   usr
  CLEAN   arch/arm/boot/compressed
  CLEAN   arch/arm/boot
  CLEAN   .tmp_versions
[root@localhost linux-3.8.7]# make

Create Rootfs

Use a tool mkyaffs2image to create a yaffs2 rootfs from rootfs directory, a directory rootfs will be generated.

[root@localhost mini2440]# cd rootfilesystem/
[root@localhost rootfilesystem]# ls
create_rootfs_bash.sh  initramfs.cpio  mkyaffs2image-128M  rootfs  rootfs-base  rootfs.img  yaffs2-4e188b0  yaffs2-4e188b0.tar.gz
[root@localhost rootfilesystem]# vim create_rootfs_bash.sh
[root@localhost rootfilesystem]# pwd
/home/iot/mini2440/rootfilesystem
[root@localhost rootfilesystem]# ./create_rootfs_bash.sh
------Create rootfs --------
/home/iot/mini2440/rootfilesystem/rootfs /home/iot/mini2440/rootfilesystem
--------Create root,dev....----------
---------Copy from busybox, rootfs-base, libs -----------
---------make node dev/console dev/null-----------------
mknod: ‘/dev/ptmx’: File exists
14169 blocks
/home/iot/mini2440/rootfilesystem
[root@localhost rootfilesystem]#

Use below command mkyaffs2image-128M to convert rootfs to a yaffs2 image.

[root@localhost rootfilesystem]# ls
create_rootfs_bash.sh  initramfs.cpio  mkyaffs2image-128M  rootfs  rootfs-base  rootfs.img  yaffs2-4e188b0  yaffs2-4e188b0.tar.gz
[root@localhost rootfilesystem]# ll
total 9412
-rwxr-xr-x.  1 root root    1847 Dec 28  2018 create_rootfs_bash.sh
-rw-r--r--.  1 root root 7254528 Jul  8 14:39 initramfs.cpio
-rwx------.  1 root root   15662 Dec 28  2018 mkyaffs2image-128M
drwxr-xr-x. 16 root root    4096 Jul  8 14:39 rootfs
drwxr-xr-x.  3 root root    4096 Dec 28  2018 rootfs-base
-rw-------.  1 root root 2048640 Dec 28  2018 rootfs.img
drwxr-xr-x.  7 root root    4096 Dec 28  2018 yaffs2-4e188b0
-rw-r--r--.  1 root root  291488 Dec 28  2018 yaffs2-4e188b0.tar.gz
[root@localhost rootfilesystem]# ./mkyaffs2image-128M rootfs rootfs.img
mkyaffs2image: image building tool for YAFFS2 built Jul  9 2009
Processing directory rootfs into image file rootfs.img
Object 257, rootfs/var is a directory
... ...
Object 464, rootfs/sbin/init is a symlink to "../bin/busybox"
Operation complete.
208 objects in 31 directories
3776 NAND pages

Check the newly generated rootfs.img file.

[root@localhost rootfilesystem]# ll
total 15196
-rwxr-xr-x.  1 root root    1847 Dec 28  2018 create_rootfs_bash.sh
-rw-r--r--.  1 root root 7254528 Jul  8 14:39 initramfs.cpio
-rwx------.  1 root root   15662 Dec 28  2018 mkyaffs2image-128M
drwxr-xr-x. 16 root root    4096 Jul  8 14:39 rootfs
drwxr-xr-x.  3 root root    4096 Dec 28  2018 rootfs-base
-rw-------.  1 root root 7974912 Jul  8 14:41 rootfs.img
drwxr-xr-x.  7 root root    4096 Dec 28  2018 yaffs2-4e188b0
-rw-r--r--.  1 root root  291488 Dec 28  2018 yaffs2-4e188b0.tar.gz
[root@localhost rootfilesystem]#

Download Kernel Image and Rootfs to the S3C2440 board

First in the bootloader menu, select k to download the linux kernel zImage, note this zImage will exclude the initramfs.cpio file, and the size of zImage will be much smaller.

##### FriendlyARM BIOS 2.0 for 2440 #####
[x] format NAND FLASH for Linux
[v] Download vivi 
[k] Download linux kernel 
[y] Download root_yaffs image 
[a] Absolute User Application
[n] Download Nboot for WinCE 
[l] Download WinCE boot-logo
[w] Download WinCE NK.bin 
[d] Download & Run 
[z] Download zImage into RAM 
[g] Boot linux from RAM 
[f] Format the nand flash 
[b] Boot the system 
[s] Set the boot parameters 
[u] Backup NAND Flash to HOST through USB(upload) 
[r] Restore NAND Flash from HOST through USB 
[q] Goto shell of vivi 
[i] Version: 1026-2K
Enter your selection: q
Supervivi> part show
Number of partitions: 4
name            :       offset          size            flag
------------------------------------------------------------
vivi            :       0x00000000      0x00040000      0
param           :       0x00040000      0x00020000      0
root            :       0x00660000      0x3fa80000      0
kernel          :       0x00060000      0x00600000      0
Supervivi> param show
Number of parameters: 9
name                    :          hex             integer
-------------------------------------------------------------
mach_type               :       000007cf                 1999
media_type              :       00000003                    3
boot_mem_base           :       30000000            805306368
baudrate                :       0001c200               115200
xmodem                  :       00000001                    1
xmodem_one_nak          :       00000000                    0
xmodem_initial_timeout  :       000493e0               300000
xmodem_timeout          :       000f4240              1000000
boot_delay              :       01000000             16777216
Linux command line: noinitrd init=/init console=ttySAC0,115200

Supervivi> menu exit

Download 'zImage'.

##### FriendlyARM BIOS 2.0 for 2440 #####
[x] format NAND FLASH for Linux
[v] Download vivi 
[k] Download linux kernel 
[y] Download root_yaffs image 
[a] Absolute User Application
[n] Download Nboot for WinCE 
[l] Download WinCE boot-logo
[w] Download WinCE NK.bin 
[d] Download & Run 
[z] Download zImage into RAM 
[g] Boot linux from RAM 
[f] Format the nand flash 
[b] Boot the system 
[s] Set the boot parameters 
[u] Backup NAND Flash to HOST through USB(upload) 
[r] Restore NAND Flash from HOST through USB 
[q] Goto shell of vivi 
[i] Version: 1026-2K
Enter your selection: k
USB host is not connected yet.
Uhost is connected. Waiting a download

At host, send the zImage file to S3C2440 board as below,

[root@localhost mini2440]# ./download_image.sh
csum = 0x5d83
send_file: addr = 0x33f80000, len = 0x00253020

At minicom S3C2440 board side, receive the zImage file.

##### FriendlyARM BIOS 2.0 for 2440 #####
[x] format NAND FLASH for Linux
[v] Download vivi 
[k] Download linux kernel 
[y] Download root_yaffs image 
[a] Absolute User Application
[n] Download Nboot for WinCE 
[l] Download WinCE boot-logo
[w] Download WinCE NK.bin 
[d] Download & Run 
[z] Download zImage into RAM 
[g] Boot linux from RAM 
[f] Format the nand flash 
[b] Boot the system 
[s] Set the boot parameters 
[u] Backup NAND Flash to HOST through USB(upload) 
[r] Restore NAND Flash from HOST through USB 
[q] Goto shell of vivi 
[i] Version: 1026-2K
Enter your selection: k
USB host is connected. Waiting a download.

Now, Downloading [ADDRESS:30000000h,TOTAL:2437162]
RECEIVED FILE SIZE: 2437162 (18KB/S, 129S)
Downloaded file at 0x30000000, size = 2437152 bytes
Found block size = 0x00260000
Erasing...    ... done
Writing...    ... done
Written 2437152 bytes


The second step is to download the rootfs.img, as earlier zImage downloading doesn't include the rootfs, so we download this yaffs2 rootfs image separately.

[root@localhost mini2440]# ll rootfilesystem/rootfs*
-rw-------.  1 root root 7974912 Jul  8 14:41 rootfilesystem/rootfs.img

As my Fedora Linux is working on Oracle virtualbox virtual machine, somehow the downloading of the rootfs was not working properly and downloading will hang after a few seconds of writing, I have to use a imageUSB software to make a Fedora USB booting, and bootup from Fedora Linux USB on my laptop computer to use the physical USB port to download the rootfs. The loading was successful, below is the photo,

downlaod yaffs2 rootfs image

Change linux_cmd_line parameter.

##### FriendlyARM BIOS 2.0 for 2440 #####
[x] format NAND FLASH for Linux
[v] Download vivi 
[k] Download linux kernel 
[y] Download root_yaffs image 
[a] Absolute User Application
[n] Download Nboot for WinCE 
[l] Download WinCE boot-logo
[w] Download WinCE NK.bin 
[d] Download & Run 
[z] Download zImage into RAM 
[g] Boot linux from RAM 
[f] Format the nand flash 
[b] Boot the system 
[s] Set the boot parameters 
[u] Backup NAND Flash to HOST through USB(upload) 
[r] Restore NAND Flash from HOST through USB 
[q] Goto shell of vivi 
[i] Version: 1026-2K
Enter your selection: s

##### Parameter Menu #####
[r] Reset parameter table to default table 
[s] Set parameter 
[v] View the parameter table  
[w] Write the parameter table to flash memeory 
[q] Quit 
Enter your selection: v
Number of parameters: 9
name                    :          hex             integer
-------------------------------------------------------------
mach_type               :       000007cf                 1999
media_type              :       00000003                    3
boot_mem_base           :       30000000            805306368
baudrate                :       0001c200               115200
xmodem                  :       00000001                    1
xmodem_one_nak          :       00000000                    0
xmodem_initial_timeout  :       000493e0               300000
xmodem_timeout          :       000f4240              1000000
boot_delay              :       01000000             16777216
Linux command line: noinitrd init=/init console=ttySAC0,115200

##### Parameter Menu #####
[r] Reset parameter table to default table 
[s] Set parameter 
[v] View the parameter table  
[w] Write the parameter table to flash memeory 
[q] Quit 
Enter your selection: s
Enter the parameter's name(mach_type, media_type, linux_cmd_line, etc): linux_cmd_line
Enter the parameter's value(if the value contains space, enclose it with "): "root=/dev/mtdblock3 console=ttySAC0,115200"
Change linux command line to "root=/dev/mtdblock3 console=ttySAC0,115200"

##### Parameter Menu #####
[r] Reset parameter table to default table 
[s] Set parameter 
[v] View the parameter table  
[w] Write the parameter table to flash memeory 
[q] Quit 
Enter your selection: w
Found block size = 0x00020000
Erasing...    ... done
Writing...    ... done
Written 49152 bytes
Saved vivi private data

##### Parameter Menu #####
[r] Reset parameter table to default table 
[s] Set parameter 
[v] View the parameter table  
[w] Write the parameter table to flash memeory 
[q] Quit 
Enter your selection: v
Number of parameters: 9
name                    :          hex             integer
-------------------------------------------------------------
mach_type               :       000007cf                 1999
media_type              :       00000003                    3
boot_mem_base           :       30000000            805306368
baudrate                :       0001c200               115200
xmodem                  :       00000001                    1
xmodem_one_nak          :       00000000                    0
xmodem_initial_timeout  :       000493e0               300000
xmodem_timeout          :       000f4240              1000000
boot_delay              :       01000000             16777216
Linux command line: root=/dev/mtdblock3 console=ttySAC0,115200

##### Parameter Menu #####
[r] Reset parameter table to default table 
[s] Set parameter 
[v] View the parameter table  
[w] Write the parameter table to flash memeory 
[q] Quit 
Enter your selection:

Boot the S3C2440 board, the YAFFS2 file system is working fine, the latest rootfs is also including the network setting..

You can see linux command line is: "root=/dev/mtdblock3 console=ttySAC0,115200" during the startup.

##### FriendlyARM BIOS 2.0 for 2440 #####
[x] format NAND FLASH for Linux
[v] Download vivi 
[k] Download linux kernel 
[y] Download root_yaffs image 
[a] Absolute User Application
[n] Download Nboot for WinCE 
[l] Download WinCE boot-logo
[w] Download WinCE NK.bin 
[d] Download & Run 
[z] Download zImage into RAM 
[g] Boot linux from RAM 
[f] Format the nand flash 
[b] Boot the system 
[s] Set the boot parameters 
[u] Backup NAND Flash to HOST through USB(upload) 
[r] Restore NAND Flash from HOST through USB 
[q] Goto shell of vivi 
[i] Version: 1026-2K
Enter your selection: b
Copy linux kernel from 0x00060000 to 0x30008000, size = 0x00600000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "root=/dev/mtdblock3 console=ttySAC0,115200"
MACH_TYPE = 1999
NOW, Booting Linux......
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.8.7-FriendlyARM (root@localhost.localdomain) (gcc version 4.7.2 (Buildroot 2013.02) ) #11 Wed Jul 10 09:36:37 SGT 2019
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: MINI2440
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: root=/dev/mtdblock3 console=ttySAC0,115200
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
__ex_table already sorted, skipping sort
Memory: 64MB = 64MB total
Memory: 59596k/59596k available, 5940k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc4800000 - 0xff000000   ( 936 MB)
    lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc0496ee4   (4668 kB)
      .init : 0xc0497000 - 0xc04b7c5c   ( 132 kB)
      .data : 0xc04b8000 - 0xc04f50c8   ( 245 kB)
       .bss : 0xc04f50c8 - 0xc0535c80   ( 259 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:85
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
sched_clock: 32 bits at 200 Hz, resolution 5000000ns, wraps every 4294967291ms
Console: colour dummy device 80x30
Calibrating delay loop... 201.52 BogoMIPS (lpj=503808)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x3035ee70 - 0x3035eeac
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
MINI2440: Option string mini2440=0tb
MINI2440: 't' ignored, touchscreen not compiled in
MINI2440: LCD [0:240x320] 1:800x480 2:1024x768 3:320x240
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Linux video capture interface: v2.00
NET: Registered protocol family 2
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
msgmni has been set to 116
alg: No test for stdrng (krng)
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 30x20
s3c2410-lcd s3c2410-lcd: fb0: s3c2410fb frame buffer device
s3c2440-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a S3C2440
console [ttySAC0] enabled
s3c2440-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: ttySAC2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
Loading iSCSI transport class v2.0-870.
s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit), 256MiB, page size: 2048, OOB size: 64
Creating 4 MTD partitions on "nand":
0x000000000000-0x000000040000 : "u-boot"
0x000000040000-0x000000060000 : "u-boot-env"
0x000000060000-0x000000660000 : "kernel"
0x000000660000-0x000010000000 : "root"
dm9000 Ethernet Driver, V1.31
dm9000_probe Set bwscon and bankcon4
dm9000 dm9000: read wrong id 0x01010101
dm9000 dm9000: eth%d: Invalid ethernet MAC address. Please set using ifconfig
Now use the default MAC address: 08:90:90:90:90:90
eth0: dm9000e at c48bc300,c48be304 IRQ 51 MAC: 08:90:90:90:90:90 (chip)
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver rndis_host
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mousedev: PS/2 mouse device common for all mice
s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
oprofile: no performance counters
oprofile: using timer interrupt.
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
Key type dns_resolver registered
console [netcon0] enabled
netconsole: network logging started
s3c-rtc s3c2410-rtc: setting system clock to 2004-02-06 00:53:54 UTC (1076028834)
FAT-fs (mtdblock3): utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
yaffs: dev is 32505859 name is "mtdblock3" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs filesystem) on device 31:3.
Freeing init memory: 128K
starting pid 458, tty '': '/etc/init.d/rcS'
* Mounting /proc...
* Mounting /dev...
* Mounting /sys...
* Mounting /dev/pts...
* Mounting /dev/shm...
* Starting system loggers...
* Creating devices...
* Configuring loopback interface...
* Setting hostname...
eth0 up
dm9000 dm9000 eth0: link down
starting pid 474, tty '': '/usr/sbin/telnetd -l /bin/login'
starting pid 475, tty '': '-/bin/login'
mini2440 login: root
-sh: can't access tty; job control turned off
[root@mini2440 /root]# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:90:90:90:90:90  
          inet addr:192.168.0.11  Bcast:192.168.0.255  Mask:255.255.255.0
          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)
          Interrupt:51 Base address:0xc300 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  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:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

[root@mini2440 /root]#

Problems, trouble shooting and solutions

Problem 1, How to force Fedora to start to command line console mode?

I had created Fedora USB booting to use my laptop computer to use the physical USB port to download the rootfs yaffs2 file, so have to bootup to command line console mode, as below photo shows, have put 3 at the end of vmlinuz line. Refer to this link How to force Fedora 12 to start to text mode?

setting command line 3

Problem 2, How to mount usb flash drive in fedora?

Refer to this link how to mount usb flash drive in fedora?, use this commmad mount /dev/disk/by-label/USBlabel /mnt/ can mount the USB drive.

Problem 3, Managing minicom settings

If minicomsetting was not correct, need to change the minicom setting, refer to this link, Managing minicom settings, use command minicom -s to change the setting such as port, and save the setting as file name alix, re-use the setting by startup the minicom as minicom alix.

Problem 4, Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)

The kernel panic error was as below shows,

Copy linux kernel from 0x00060000 to 0x30008000, size = 0x00600000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "root=/dev/mtdblock3 console=ttySAC0,115200"
MACH_TYPE = 1999
NOW, Booting Linux......
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.8.7-FriendlyARM (root@localhost.localdomain) (gcc version 4.7.2 (Buildroot 2013.02) ) #10 Wed Jul 10 09:15:17 SGT 2019
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: MINI2440
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: root=/dev/mtdblock3 console=ttySAC0,115200
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
__ex_table already sorted, skipping sort
Memory: 64MB = 64MB total
Memory: 59684k/59684k available, 5852k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc4800000 - 0xff000000   ( 936 MB)
    lowmem  : 0xc0000000 - 0xc4000000   (  64 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc0480ee4   (4580 kB)
      .init : 0xc0481000 - 0xc04a1ad8   ( 131 kB)
      .data : 0xc04a2000 - 0xc04df008   ( 245 kB)
       .bss : 0xc04df008 - 0xc051fba0   ( 259 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:85
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
sched_clock: 32 bits at 200 Hz, resolution 5000000ns, wraps every 4294967291ms
Console: colour dummy device 80x30
Calibrating delay loop... 201.52 BogoMIPS (lpj=503808)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x3034dbb0 - 0x3034dbec
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
MINI2440: Option string mini2440=0tb
MINI2440: 't' ignored, touchscreen not compiled in
MINI2440: LCD [0:240x320] 1:800x480 2:1024x768 3:320x240
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Linux video capture interface: v2.00
NET: Registered protocol family 2
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
msgmni has been set to 116
alg: No test for stdrng (krng)
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 30x20
s3c2410-lcd s3c2410-lcd: fb0: s3c2410fb frame buffer device
s3c2440-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a S3C2440
console [ttySAC0] enabled
s3c2440-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: ttySAC2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
Loading iSCSI transport class v2.0-870.
s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit), 256MiB, page size: 2048, OOB size: 64
Creating 4 MTD partitions on "nand":
0x000000000000-0x000000040000 : "u-boot"
0x000000040000-0x000000060000 : "u-boot-env"
0x000000060000-0x000000660000 : "kernel"
0x000000660000-0x000010000000 : "root"
dm9000 Ethernet Driver, V1.31
dm9000_probe Set bwscon and bankcon4
dm9000 dm9000: read wrong id 0x01010101
dm9000 dm9000: eth%d: Invalid ethernet MAC address. Please set using ifconfig
Now use the default MAC address: 08:90:90:90:90:90
eth0: dm9000e at c48bc300,c48be304 IRQ 51 MAC: 08:90:90:90:90:90 (chip)
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver rndis_host
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mousedev: PS/2 mouse device common for all mice
s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
s3c-rtc s3c2410-rtc: warning: invalid RTC value so initializing it
oprofile: no performance counters
oprofile: using timer interrupt.
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
Key type dns_resolver registered
console [netcon0] enabled
netconsole: network logging started
s3c-rtc s3c2410-rtc: setting system clock to 2000-01-01 00:00:00 UTC (946684800)
FAT-fs (mtdblock3): utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
List of all partitions:
1f00             256 mtdblock0  (driver?)
1f01             128 mtdblock1  (driver?)
1f02            6144 mtdblock2  (driver?)
1f03          255616 mtdblock3  (driver?)
No filesystem could mount root, tried:  ext3 ext2 ext4 vfat
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)

Firstly refer to this link SD card kernel panic, I thought the Ext3 file system was not included into Kernel, added the Ext3 file system support and re-compile the kernel,

<*> Ext3 journalling file system support

After test I found it was not caused by the setting of Ext3 file system support, it was caused by yaffs2 file system support below, when I was doing the test, I missed out below setting step, after I set the yaffs2 setting, re-compile the kernel and download the new zImage, the kernel panic issue was resolved.

<*>   yaffs2 file system support

Problem 5, cannot bootup from Fedora USB system

The booting wasn't entering the Fedora USB system, have to make some changes to my Lenovo X1 BIOS setting, as below,

In the Startup, have to set the UEFI/Legacy Boot as both.
BIOS setting 1

In the Security, have to set the Secure Boot as Disabled.
BIOS setting 2

In the Config, have to set the USB UEFI BIOS Support as Enabled.
BIOS setting 3

Reference

Embedded Linux S3C2440 environment setup
Embedded Linux S3C2440 Environment Startup
Embedded Linux S3C2440 Build and Boot an Image
Embedded Linux S3C2440 Application Development and Debugging
Embedded Linux S3C2440 Networking
Embedded Linux S3C2440 – Kernel Module
Embedded Linux S3C2440 – Kernel Debugging
Embedded Linux S3C2440 – Multi-thread Scheduling
Embedded Linux S3C2440 Profiling
Embedded Linux S3C2440 – QEMU and Graphic
YAFFS Wiki
How to force Fedora 12 to start to text mode?
how to mount usb flash drive in fedora?
Managing minicom settings
SD card kernel panic

Write a Comment

Comment

five × 5 =