{"id":16219109,"url":"https://github.com/nikize/gentoo-ipxe","last_synced_at":"2025-08-23T05:09:54.194Z","repository":{"id":144996118,"uuid":"387153730","full_name":"NiKiZe/Gentoo-iPXE","owner":"NiKiZe","description":"Sample to support iPXE boot of Gentoo Minimal livecd","archived":false,"fork":false,"pushed_at":"2022-01-06T12:21:43.000Z","size":61,"stargazers_count":19,"open_issues_count":8,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-08-17T04:39:22.142Z","etag":null,"topics":["boot","gentoo","ipxe","livecd","netboot","pxe-boot"],"latest_commit_sha":null,"homepage":"https://gentoo.ipxe.se/","language":"Shell","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/NiKiZe.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-18T10:58:24.000Z","updated_at":"2024-10-11T16:43:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"c51abde8-3a77-4a24-807c-5694e8f695f1","html_url":"https://github.com/NiKiZe/Gentoo-iPXE","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NiKiZe/Gentoo-iPXE","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiKiZe%2FGentoo-iPXE","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiKiZe%2FGentoo-iPXE/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiKiZe%2FGentoo-iPXE/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiKiZe%2FGentoo-iPXE/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NiKiZe","download_url":"https://codeload.github.com/NiKiZe/Gentoo-iPXE/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NiKiZe%2FGentoo-iPXE/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271745490,"owners_count":24813503,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["boot","gentoo","ipxe","livecd","netboot","pxe-boot"],"created_at":"2024-10-10T11:53:01.284Z","updated_at":"2025-08-23T05:09:54.173Z","avatar_url":"https://github.com/NiKiZe.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Gentoo-iPXE](https://github.com/NiKiZe/Gentoo-iPXE)\nExample on Minimal Gentoo PXE boot with focus on using [iPXE](http://ipxe.org)\n\n[![iPXE booting Gentoo sample screen](https://b800.org/3hf9U.png)](https://b800.org/3hf9U)\n\n### Background\nThis is to show and use how Gentoo can be booted over PXE since [Gentoo bug #396467](https://bugs.gentoo.org/396467) was resolved\nin [24ad50](https://github.com/gentoo/genkernel/commit/24ad5065fa856389ee9b058f57adffbe752da157)\n\n## Quick start\nQuick QEMU test: `qemu-system-x86_64 -enable-kvm -M q35 -m 1024 -cpu host -nic user,model=virtio,tftp=.,bootfile=http://gentoo.ipxe.se/boot.ipxe -boot menu=on -usb`\nThis uses [iPXE](http://boot.ipxe.org), manual steps:\n* Get into the iPXE shell (from PXE boot or even from one of the disk images)\n* Get ip `dhcp`\n* Start Gentoo `chain http://gentoo.ipxe.se/boot.ipxe`\n\n#### Explanation of ipxe script\nIf a file is referred to in a iPXE script, and not given as absolute path it tries to load from the \"last path\"\n* `kernel gentoo root=/dev/ram0 init=/linuxrc  dokeymap looptype=squashfs loop=/image.squashfs  cdroot initrd=initrd.magic vga=791` - download gentoo kernel image, and append standard cmdline as seen in isolinux/grub, the initrd= is required for the kernel to find the init file in EFI mode boot\n* `initrd combined.igz` - downloads combined.igz into memory - you can give the full path over http or tftp if you want to.\n* `boot` - boot\n\n#### Testing\nScript to simplify testing: [`test_w_qemu.sh useonline`](test_w_qemu.sh)\nSee [Issue #4 for more work on EFI](https://github.com/NiKiZe/Gentoo-iPXE/issues/4)\n\n## Having Gentoo mirrors host the needed files\nWorking on this, See [Gentoo bug #494300](https://bugs.gentoo.org/494300) and [issue #2](https://github.com/NiKiZe/Gentoo-iPXE/issues/2). There is also [forum post](https://forums.gentoo.org/viewtopic-p-8636881.html#8636881)\n\n## Create your own mirror\nGrab or create [`boot.ipxe`](boot.ipxe) script with the minimal configuration.\nUse [`gentoocd_unpack.sh`](gentoocd_unpack.sh) to download latest iso and unpack needed files.\nIf you want to extract them yourself then it ise these files you need\n* `/boot/gentoo`\n* `/boot/gentoo.igz`\n* `/image.squashfs`\nAnd finaly create the combined initrd using `(cat boot/gentoo.igz; (echo image.squashfs | cpio -H newc -o)) \u003e combined.igz`\n\n### Setting up your own server\nNeeded services are BOOTP/DHCP and TFTP. Refer to these services individually.\nYou might also want to have a HTTP server for better performance.\n\"PXE server\" might refer to the one machine that serves both of these services.\n#### TFTP service\nInstall a simple to use tftp server\n```bash\n# install atftp\nemerge -uv1 net-ftp/atftp\n# ensure we have tftp root directory\nmkdir -p /tftproot\n# add it to startup\nrc-update add atftp default\n# make sure it is running\n/etc/init.d/atftp restart\n\n# move to tftp root directory\npushd /tftproot\n# Prepare iPXE files\nfor i in ipxe.efi snponly.efi undionly.kpxe ipxe.pxe; do wget -nc http://boot.ipxe.org/$i; done\n\n# Optional Prepare Grub\ngrub-mknetdir --net-directory .\n\n# Optional Prepare pxelinux\nemerge -uv1 syslinux\ncp /usr/share/syslinux/pxelinux.0 .\ncp /usr/share/syslinux/ldlinux.c32 .\n\n# TODO copy over configs for grub/pxelinux\n\npopd\n```\n\n#### BOOTP/DHCP service\nUse one of these, not both\n##### isc-dhcpd\n[This configuration](https://gist.github.com/robinsmidsrod/4008017) as a great start for iPXE, [official documentation](https://ipxe.org/howto/chainloading#breaking_the_infinite_loop) can also be helpful.\nIf you are in control of your DHCP server, then this is the best option.\n##### dnsmasq Proxy DHCP mode\n\nIf you can not replace your DHCP server then you can instead run [Proxy DHCP](https://ipxe.org/appnote/proxydhcp).\n[Full configuration for dnsmasq in proxydhcp mode](https://gist.github.com/NiKiZe/5c181471b96ac37a069af0a76688944d)\n```bash\n# Disable DNS server\nport=0\n\n# Configure proxy mode and interface\ndhcp-range=${interface_subnet},proxy\ninterface=${interface_name}\n\n# Enable PXE menu for non iPXE clients\ndhcp-match=set:ipxe-ok,175,19\npxe-service=tag:!ipxe-ok,X86PC,PXE,undionly.kpxe,${tftp_server_ip}\npxe-service=tag:!ipxe-ok,BC_EFI,PXE,snponly.efi,${tftp_server_ip}\npxe-service=tag:!ipxe-ok,X86-64_EFI,PXE,snponly.efi,${tftp_server_ip}\n\n# Send script to valid iPXE clients\ndhcp-boot=tag:ipxe-ok,http://gentoo.ipxe.se/boot.ipxe,,0.0.0.1\n```\n\n### [Alternative client side CPIO combine](altcombine.ipxe)\nAbove server side generated `combined.igz` has been used. It is also possible to do this client side.\n* `initrd gentoo.igz`\n* `kernel gentoo {insert options} initrd=initrd.magic`\n* `initrd image.squashfs /image.squashfs`\nLast initrd Appends squashfs with CPIO header to the ram data, the second argument tells which name to use in CPIO archive\n\nAs mentioned `initrd=` is required in EFI mode, `initrd.magic` is a special file in iPXE EFI since [e5f025](https://github.com/ipxe/ipxe/commit/e5f02551735922eb235388bff08249a6f31ded3d) that combines all initrd files into one CPIO archive, pcbios has done the same concatination for a long time.\n\n### [Different types of combine](combined.ipxe)\n* `(cat gentoo.igz; (echo image.squashfs | cpio -H newc -o)) \u003e combined.igz`\n  - simplest and fastest boot, ~390M file\n* `(cat gentoo.igz; (echo image.squashfs | cpio -H newc -o | xz --check=crc32 -vT0)) \u003e combined.igz`\n  - compress squashfs, ~360M file, black screen while kernel decompress these parts\n* `(xz -d gentoo.igz -c; (echo image.squashfs | cpio -H newc -o)) | xz --check=crc32 -vT0 \u003e combined.igz`\n  - recompress everything, ~359M file, black screen while decompressing\n\nTODO investigate memory usage, what is the best way for the kernel in terms of free memory?\n\n\u003cimg src=\"https://ipv6.b800.org/ipv6.svg\" style=\"height: 1rem; vertical-align:middle; \" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikize%2Fgentoo-ipxe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikize%2Fgentoo-ipxe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikize%2Fgentoo-ipxe/lists"}