{"id":13538591,"url":"https://github.com/rhboot/shim","last_synced_at":"2025-12-29T22:12:14.191Z","repository":{"id":2980677,"uuid":"3996476","full_name":"rhboot/shim","owner":"rhboot","description":"UEFI shim loader","archived":false,"fork":false,"pushed_at":"2025-03-14T15:05:05.000Z","size":16140,"stargazers_count":911,"open_issues_count":131,"forks_count":305,"subscribers_count":75,"default_branch":"main","last_synced_at":"2025-03-14T16:23:17.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhboot.png","metadata":{"files":{"readme":"README.fallback","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-04-11T18:00:40.000Z","updated_at":"2025-03-14T15:05:10.000Z","dependencies_parsed_at":"2024-01-14T14:58:01.785Z","dependency_job_id":"90da77f8-2f30-4e28-8aad-6cccffbbb8bf","html_url":"https://github.com/rhboot/shim","commit_stats":{"total_commits":1065,"total_committers":80,"mean_commits":13.3125,"dds":0.5070422535211268,"last_synced_commit":"f23883ccf78f1f605a272f9e5700f47e5494a71d"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhboot%2Fshim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhboot%2Fshim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhboot%2Fshim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhboot%2Fshim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhboot","download_url":"https://codeload.github.com/rhboot/shim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246763805,"owners_count":20829795,"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":[],"created_at":"2024-08-01T09:01:13.843Z","updated_at":"2025-12-29T22:12:14.152Z","avatar_url":"https://github.com/rhboot.png","language":"C","funding_links":[],"categories":["Tools","***EDK2***","C","\u003ca id=\"9eee96404f868f372a6cbc6769ccb7f8\"\u003e\u003c/a\u003e工具"],"sub_categories":["Open Source","***PoCs***","\u003ca id=\"31185b925d5152c7469b963809ceb22d\"\u003e\u003c/a\u003e新添加的"],"readme":"Somebody mailed me this:\n\n\u003e I am trying to understand how fallback.efi works.  I have been reading\n\u003e shim.c and see that fallback is called when\n\u003e should_use_fallback(EFI_HANDLE image_handle) returns a 1.  But in\n\u003e should_use_fallback(EFI_HANDLE image_handle), there is a comparison of\n\u003e bootpath to \\\\EFI\\\\BOOT\\\\BOOT.  Why is it compare to \\\\EFI\\\\BOOT\\\\BOOT\n\u003e since bootpath always return \\EFI\\Boot\\shim.efi?\n\nAnd it seems like a common enough question that we need some\ndocumentation of how to properly use shim and fallback.  Here's the\nbasics of it:\n\nIt doesn't always return \\EFI\\boot\\shim.efi - in fact, not ever if\ninstalled correctly.  The FS layouts are like this:\n\nfor removable media:\n\\EFI\\BOOT\\BOOTX64.EFI \u003c-- shim\n\\EFI\\BOOT\\MokManager.efi\n\\EFI\\BOOT\\grubx64.efi\n\\EFI\\BOOT\\grub.cfg\n\nfor an installed system:\n\\EFI\\BOOT\\BOOTX64.EFI    \u003c-- shim\n\\EFI\\BOOT\\MokManager.efi\n\\EFI\\BOOT\\fallback.efi\n\\EFI\\fedora\\BOOT.CSV\n\\EFI\\fedora\\shim.efi\n\\EFI\\fedora\\MokManager.efi\n\\EFI\\fedora\\grubx64.efi\n\\EFI\\fedora\\grub.cfg\n\nWhen you boot removable media, it'll be in \\EFI\\BOOT , but fallback.efi\nwon't be there, so it goes ahead and boots the normal bootloader\n(grubx64.efi).  When you boot a normal system through a boot variable,\nthe boot variable is configured to start \\EFI\\fedora\\shim.efi (or\nwhatever your distro's EFI directory is.)  In that case it won't try to\ninvoke fallback.  But if the boot variables are missing or corrupted,\nthe firmware will eventually try to boot the hard disk as removable\nmedia.  In that case, it'll invoke \\EFI\\BOOT\\BOOTX64.EFI (or whatever\nfilename is right for your architecture.)  In that case it'll be in\n\\EFI\\BOOT, so it'll check for fallback.efi , and it'll find it and run\nit.  When it runs, fallback will look for every directory in \\EFI\\ with\na BOOT${ARCH}.CSV in it, or BOOT.CSV if that's not found.  It'll parse that,\nand create new boot variables from what it finds.  Then it'll try to boot one\nof them.\n\nBOOT.CSV is a UCS-2 LE formatted CSV file.  So it has the LE byte order\nmarker, and after that it's just a series of lines, each having\ncomma-separated date.  It looks like this on Fedora:\n\nshim.efi,Fedora,,This is the boot entry for Fedora\n\nso basically it's:\n\n$FILENAME,$LABEL,$LOADER_DATA,$COMMENT0[,$COMMENT1[,...]]\n\nWhere $FILENAME has to be the name of a file in the same directory as\nBOOT.CSV .\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhboot%2Fshim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhboot%2Fshim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhboot%2Fshim/lists"}