From 2c34428be5784a0df1886f7ea41755e22ab3e5d3 Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Sat, 7 May 2011 06:14:45 -0500 Subject: [PATCH] script/gentree, targets/amd64/SS4200: use a separate module path instead of hacking boot --- script/gentree | 44 +++++++------------ .../SS4200/config/overlay/boot/loader.conf | 2 + targets/amd64/SS4200/config/overlay/etc/fstab | 2 +- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/script/gentree b/script/gentree index 768e6b1..3796b7c 100755 --- a/script/gentree +++ b/script/gentree @@ -225,38 +225,24 @@ do_imgboot() { log Create boot imgsrc chk mv "${sroot}/boot" "${tree}" chk mkdir -p "${sroot}/boot" - chk rm -f "${sboot}/kernel"/*.symbols - # Gzipped kernel is okay - chk onelink "${sboot}/kernel/kernel" - chk gzip -9 "${sboot}/kernel/kernel" - # Compress all files in /boot/kernel - # Loader cannot handle gzipped modules. Decompress the required modules - # kldload cannot handle gzipped modules either - #find "${sboot}/kernel" -type f | xargs gzip -9f || chk - #cat "${sboot}/loader.conf" | grep '_load=' | sed -e 's/^\(.*\)_load=.*$/\1/' | while read mod - #do - # [ -f "${sboot}/kernel/${mod}.ko.gz" ] && gunzip "${sboot}/kernel/${mod}.ko.gz" || chk - #done - # - # Instead: put all modules in the root image, except those needed to boot the kernel - chk mkdir -p "${sroot}/boot/boot" - chk mkdir -p "${sroot}/boot/kernel" - chk ln -sf "../etc/zfs" "${sroot}/boot/zfs" - - # Link all modules into the root fs - ( cd "${sboot}/kernel" && find . -name '*.ko' -o -name 'linker.hints' | cpio -p --link "${sroot}/boot/kernel" ) || chk - - # Remove all modules from the root fs that are preloaded by the loader - cat "${sboot}/loader.conf" | grep '_load=' | sed -e 's#^\(.*\)_load=.*$#'"${sroot}/boot/kernel/"'\1.ko#' | xargs rm -f + chk mkdir -p "${sroot}/modules" + chk find "${sboot}/kernel" -type f -name '*.symbols' -delete + + # Link all modules into /modules, as an alternative search path + ( cd "${sboot}/kernel" && find . -name '*.ko' -o -name "${conf}" | cpio -p --link "${sroot}/modules" ) || chk + + # Remove all modules from the root fs that are preloaded by the preloader + cat "${sboot}/loader.conf" | grep '_load=' | sed -e 's#^\(.*\)_load=.*$#'"${sroot}/modules/"'\1.ko#' | xargs rm -f # Remove all modules from the boot fs that are present in the root fs - ( cd "${sroot}/boot/kernel" && ls -1 ) | sed -e 's#^#'"${sboot}/kernel/"'#' | xargs rm -f + ( cd "${sroot}/modules" && ls -1 ) | sed -e 's#^#'"${sboot}/kernel/"'#' | xargs rm -f - # Link the preloaded modules from the boot fs to the root fs, to provide a homogenous view - ( cd "${sboot}/kernel" && ls -1 ) | while read mod - do - ln -sf "../boot/kernel/${mod}" "${sroot}/boot/kernel/${mod}" - done + # Rebuild linker hints in both places, to make sure the kernel can find everything once running + kldxref "${sboot}/kernel" "${sroot}/modules" + + # Gzip kernel to save boot space + chk onelink "${sboot}/kernel/kernel" + chk gzip -9 "${sboot}/kernel/kernel" } do_imgconf() { diff --git a/targets/amd64/SS4200/config/overlay/boot/loader.conf b/targets/amd64/SS4200/config/overlay/boot/loader.conf index 976b275..e771412 100644 --- a/targets/amd64/SS4200/config/overlay/boot/loader.conf +++ b/targets/amd64/SS4200/config/overlay/boot/loader.conf @@ -4,6 +4,8 @@ autoboot_delay="5" console="comconsole" comconsole_speed="115200" +module_path="/boot/modules;/modules" + # Be sure to include all dependencies! ahci_load="YES" coretemp_load="YES" diff --git a/targets/amd64/SS4200/config/overlay/etc/fstab b/targets/amd64/SS4200/config/overlay/etc/fstab index 4ca34d6..38e9ef1 100644 --- a/targets/amd64/SS4200/config/overlay/etc/fstab +++ b/targets/amd64/SS4200/config/overlay/etc/fstab @@ -1,3 +1,3 @@ /dev/iso9660/root / cd9660 ro 0 0 -/dev/ufs/boot /boot/boot ufs ro,noatime,sync 0 2 +/dev/ufs/boot /boot ufs ro,noatime,sync 0 2 /dev/ufs/conf /conf ufs ro,noatime,sync 0 2 -- 2.42.0