{"id":18913639,"url":"https://github.com/eerimoq/monolinux-jiffy","last_synced_at":"2025-04-15T08:31:02.025Z","repository":{"id":46731168,"uuid":"188704424","full_name":"eerimoq/monolinux-jiffy","owner":"eerimoq","description":"A Monolinux distro for the Jiffy board!","archived":false,"fork":false,"pushed_at":"2020-07-06T08:46:10.000Z","size":298436,"stargazers_count":155,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T18:50:41.800Z","etag":null,"topics":["embedded-linux","monolinux"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eerimoq.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-26T16:06:11.000Z","updated_at":"2025-03-28T00:21:33.000Z","dependencies_parsed_at":"2022-07-26T15:32:17.283Z","dependency_job_id":null,"html_url":"https://github.com/eerimoq/monolinux-jiffy","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eerimoq%2Fmonolinux-jiffy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eerimoq%2Fmonolinux-jiffy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eerimoq%2Fmonolinux-jiffy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eerimoq%2Fmonolinux-jiffy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eerimoq","download_url":"https://codeload.github.com/eerimoq/monolinux-jiffy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249035347,"owners_count":21202065,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embedded-linux","monolinux"],"created_at":"2024-11-08T10:08:27.567Z","updated_at":"2025-04-15T08:30:57.599Z","avatar_url":"https://github.com/eerimoq.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"|buildstatus|_\n|codecov|_\n|nala|_\n\nMonolinux Jiffy\n===============\n\nA Monolinux distro for the Jiffy board!\n\nMonolinux: https://github.com/eerimoq/monolinux\n\nBootloader: https://github.com/jonasblixt/punchboot\n\nHardware: https://github.com/jonasblixt/jiffy\n\nFeatures\n========\n\n- Fast development cycle (a matter of seconds from source code change\n  to entering user space).\n\n- Everything the Linux kernel provides (networking, filesystems,\n  drivers, etc).\n\n- Various libraries provided by `Monolinux`_.\n\n- Efficient and fun unit testing with `Nala`_.\n\nBoot time\n=========\n\nThe embedded Linux based system enters user space **0.33 seconds**\nafter power on. The EXT4 filesystem is ready in **0.37 seconds** and\nnetworking in **2.2 seconds**. Very impressive for an i.MX6UL SoC with\na 528 MHz ARMv7-A CPU, 1 GB DDR3 RAM and 4 GB eMMC! A reboot is even\nfaster, only **0.26 seconds** from issuing the reboot to entering user\nspace.\n\nNote that all software except the EXT4 filesystem are part of a secure\nboot chain. The system will boot even faster without secure boot, but\nunfortunately I've not had the oppertunity to try it.\n\n+-------------------+--------------+---------+\n| Measurement point | Elapsed time | Delta   |\n+===================+==============+=========+\n| Hardware          | 1 ms         | 1 ms    |\n+-------------------+--------------+---------+\n| ROM code          | 185 ms       | 184 ms  |\n+-------------------+--------------+---------+\n| Bootloader        | 271 ms       | 86 ms   |\n+-------------------+--------------+---------+\n| Linux user space  | 333 ms       | 62 ms   |\n+-------------------+--------------+---------+\n| EXT4 filesystem   | 373 ms       | 40 ms   |\n+-------------------+--------------+---------+\n| TCP/IP networking | 2.2 s        | 1.8 s   |\n+-------------------+--------------+---------+\n\nMore information about the system and its boot sequence:\n\nFirst of all, the power is turned on. The hardware releases the reset\nto the i.MX6UL about 1 millisecond later, and soon the ROM code reads\nthe bootloader from eMMC, verifies its integrity and jumps to it. This\ntakes 185 milliseconds, which is far more than expected. It's hard to\ndo anything about it as this is properitary NXP software.\n\nThe `Punchboot`_ bootloader is very fast out of the box, and to make\nit even faster the device tree patching was removed (now done compile\ntime) and the eMMC type was changed from DDR52 to HS200. The\nbootloader reads the Linux kernel (3.5 MB), ramdisk (1.4 MB) and\ndevice tree (8 kB) from eMMC and verifies them in only 86\nmilliseconds. It then start the Linux kernel. No other bootloader was\ntested, not even U-Boot.\n\nThe system's tiny Linux kernel (version 4.14.78) boots in about 62\nmilliseconds, which is very fast. This is achieved with a minimal\nkernel configuration, a few patches, a minimal device tree, and\nuncompressed kernel and ramdisk images.\n\nHere is a brief description of the `Linux kernel patches`_.\n\n- Unpack the ramdisk after drivers are probed.\n\n- Removal of unnecessary delays in the MMC driver (I hope). This is\n  possible since we know excatly which MMC is mounted on the board,\n  and that it is always powered on.\n\n- Start with MMC clock frequency at 52 MHz instaed of 400 kHz. Same\n  reasoning as in the previous bullet, but not according to spec.\n\n- Async MMC and FEC (Ethernet) driver probes to do other\n  initialization in parallel.\n\n- 10 Hz Ethernet PHY polling instead of 1 Hz. Would not be needed if\n  the PHY sends an interrupt when its link is up.\n\nThe statically linked init process, part of the ramdisk, contains the\nentire application. It's implemented in C for low overhead, both in\nRAM and CPU time. No forks. No scripts. No shared libraries. It does\nhowever contain cURL and other libraries, which makes it about 800 kB.\n\nThe EXT4 filesystem (which is not integrity checked with dmverity) is\nmounted within 40 ms after entering user space. The enabler is to\nstart the customized MMC driver early.\n\nNetworking takes by far the longest time to get ready. The main reason\nis that Ethernet auto-negotiation takes a significant amount of time,\nabout 1 to 3 seconds. Users that do not need Ethernet, or can use a\nstatic link configuration, can save a bunch of time.\n\nBelow is selected messages from the Linux kernel log to better\nunderstand what is going on. There are a few user space messages in\nthe log as well.\n\n.. code-block:: text\n\n   [    0.000000] Booting Linux on physical CPU 0x0\n   [    0.000000] Linux version 4.14.78 (erik@erik-GR8) (gcc version 9.1.0 (GCC)) #1 Tue Jun 16 19:18:46 UTC 2020\n\n   [    0.022802] Unpacking initramfs...\n   [    0.025535] mmc0: SDHCI controller on 2190000.usdhc [2190000.usdhc] using ADMA\n   [    0.034262] Freeing initrd memory: 1416K\n   [    0.035840] Freeing unused kernel memory: 172K\n   [    0.041533] 1970-01-01 00:00:00 INFO default Successfully inserted '/root/fec.ko'.\n   [    0.053621] 1970-01-01 00:00:00 INFO default Successfully inserted '/root/ext4.ko'.\n   [    0.057696] fec 2188000.ethernet eth0: registered PHC device 0\n   [    0.058009] mmcblk0: p1 p2 p3 p4 p5 p6\n   [    0.076813] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Opts: (null)\n   [    0.082744] 1970-01-01 00:00:00 INFO default /ext4fs/README: +-----------------+\n   [    0.082812] 1970-01-01 00:00:00 INFO default /ext4fs/README: | Monolinux Jiffy |\n   [    0.082869] 1970-01-01 00:00:00 INFO default /ext4fs/README: +-----------------+\n   [    0.114466] SMSC LAN8710/LAN8720 2188000.ethernet-1:01: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=2188000.ethernet-1:01, irq=POLL)\n   [    0.114607] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready\n   [    1.892754] fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx\n   [    1.892791] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready\n   [    1.893268] 1970-01-01 00:00:01 INFO dhcp_client Starting on interface 'eth0'.\n   [    1.900520] 1970-01-01 00:00:01 INFO dhcp_client Received OFFER packet.\n\nMore ideas:\n\n- Compile for the Thumb instruction set for significantly smaller\n  binaries. Has been tested, but the init process crashes.\n\n  .. code-block:: text\n\n     [    0.560005] Freeing unused kernel memory: 1024K\n     [    0.565155] Internal error: Oops - BUG: 0 [#1] THUMB2\n     [    0.570222] Modules linked in:\n     [    0.573294] CPU: 0 PID: 1 Comm: init Not tainted 4.14.78 #19\n     [    0.578959] Hardware name: Freescale i.MX6 Ultralite (Device Tree)\n     [    0.585148] task: c7009800 task.stack: c702e000\n     [    0.589685] pc : [\u003cc0205ba2\u003e]    lr : [\u003cc0205ba2\u003e]    psr: 60000013\n     [    0.595957] sp : c702ffa8  ip : 50c53c7d  fp : 00000000\n     [    0.601187] r10: 00000000  r9 : c702e000  r8 : c0205dc4\n     [    0.606420] r7 : 000f0005  r6 : 00000000  r5 : 00000000  r4 : 000224d4\n     [    0.612956] r3 : c702e000  r2 : 0002254c  r1 : c702ffb0  r0 : 00000000\n     [    0.619492] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none\n     [    0.626633] Control: 50c53c7d  Table: 871b0059  DAC: 00000051\n     [    0.632387] Process init (pid: 1, stack limit = 0xc702e208)\n     [    0.637967] Stack: (0xc702ffa8 to 0xc7030000)\n     [    0.642340] ffa0:                   000224d4 00000000 0002254c 00022098 beca7fda 00022094\n     [    0.650531] ffc0: 000224d4 00000000 00000000 000f0005 00000000 6474e551 00000000 00000000\n     [    0.658722] ffe0: 00000037 beca7df0 00010688 000111bc 20000010 0002254c 00000000 00000000\n     [    0.666920] Code: 00004770 00000000 00000000 b6720000 (2008f8d9)\n     [    0.673020] ---[ end trace e0ea9fb97d0d2058 ]---\n     [    0.677644] Kernel panic - not syncing: Fatal exception\n\n- The MMC is setup by the bootlaoder. Update the Linux MMC driver to\n  take advantage of this. No additional setup should be needed.\n\nMeasurements\n------------\n\nTest sequence\n^^^^^^^^^^^^^\n\n#. Unmount and power off the board.\n\n   .. code-block:: text\n\n      $ umount ext4fs\n      $ poweroff\n\n#. Unplug the USB cable.\n\n#. Start a logic analyzer capture.\n\n#. Plug in the USB cable.\n\n#. Wait for the system to start.\n\n#. Stop the logic analyzer capture.\n\nMeasurement points\n^^^^^^^^^^^^^^^^^^\n\n.. code-block:: text\n\n   Hardware:   RST_N high\n   ROM code:   GPIO low\n   Bootloader: GPIO high\n   Linux:      \"main\" printed\n   Filesystem: dmesg \"mounted...\" - dmesg \"Freeing...\" + \"main\" printed\n   Network:    dmesg \"Received OFFER...\" - dmesg \"Freeing...\" + \"main\" printed\n\nBuild and run\n=============\n\nThis requires that punchboot is running and ready to execute commands.\n\n.. code-block:: shell\n\n   $ ./rundocker.sh\n   $ make -s -j8 upload\n\n.. |buildstatus| image:: https://travis-ci.org/eerimoq/monolinux-jiffy.svg\n.. _buildstatus: https://travis-ci.org/eerimoq/monolinux-jiffy\n\n.. |codecov| image:: https://codecov.io/gh/eerimoq/monolinux-jiffy/branch/master/graph/badge.svg\n.. _codecov: https://codecov.io/gh/eerimoq/monolinux-jiffy\n\n.. |nala| image:: https://img.shields.io/badge/nala-test-blue.svg\n.. _nala: https://github.com/eerimoq/nala\n\n.. _Monolinux: https://github.com/eerimoq/monolinux\n\n.. _Nala: https://github.com/eerimoq/nala\n\n.. _Linux kernel patches: https://github.com/eerimoq/linux/compare/e7405910ca5553eae8744af4e5c03e64ee048cb1..a3f1f66ab66b1c03731530e86dcc7262237a437d\n\n.. _Punchboot: https://github.com/jonasblixt/punchboot\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feerimoq%2Fmonolinux-jiffy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feerimoq%2Fmonolinux-jiffy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feerimoq%2Fmonolinux-jiffy/lists"}