Skip to content

Commit c68e591

Browse files
hudeng-goliujianqiang-niu
authored andcommitted
feat: add sw64 support
1 parent 51d56c2 commit c68e591

File tree

3 files changed

+260
-0
lines changed

3 files changed

+260
-0
lines changed

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
util-linux (2.40.4-3deepin7) unstable; urgency=medium
2+
3+
* feat: add sw64 support
4+
5+
-- Deepin Packages Builder <[email protected]> Fri, 13 Jun 2025 11:14:41 +0800
6+
17
util-linux (2.40.4-3deepin6) unstable; urgency=medium
28

39
* fix var/run/utmp don't be updated after logout
Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
2+
Index: deepin-util-linux/include/audit-arch.h
3+
===================================================================
4+
--- deepin-util-linux.orig/include/audit-arch.h 2025-02-18 19:21:07.023602174 +0800
5+
+++ deepin-util-linux/include/audit-arch.h 2025-03-07 13:31:55.000000000 +0800
6+
@@ -73,7 +73,7 @@
7+
# else
8+
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_PARISC64
9+
# endif
10+
-#elif __alpha__
11+
+#elif defined(__alpha__) || defined(__sw_64__)
12+
# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_ALPHA
13+
#else
14+
# error Unknown target architecture
15+
Index: deepin-util-linux/include/pt-bsd.h
16+
===================================================================
17+
--- deepin-util-linux.orig/include/pt-bsd.h 2025-02-13 14:02:59.262491804 +0800
18+
+++ deepin-util-linux/include/pt-bsd.h 2025-03-07 13:32:39.912939562 +0800
19+
@@ -14,7 +14,7 @@
20+
21+
#define BSD_LINUX_BOOTDIR "/usr/ucb/mdec"
22+
23+
-#if defined (__alpha__) || defined (__powerpc__) || \
24+
+#if defined (__alpha__) || defined (__powerpc__) || defined (__sw_64__) ||\
25+
defined (__ia64__) || defined (__hppa__)
26+
# define BSD_LABELSECTOR 0
27+
# define BSD_LABELOFFSET 64
28+
@@ -141,7 +141,7 @@
29+
#define BSD_FS_ADVFS 16 /* Digital Unix AdvFS */
30+
31+
/* this is annoying, but it's also the way it is :-( */
32+
-#ifdef __alpha__
33+
+#if defined(__alpha__) || defined(__sw_64__)
34+
#define BSD_FS_EXT2 8 /* ext2 file system */
35+
#else
36+
#define BSD_FS_MSDOS 8 /* MS-DOS file system */
37+
Index: deepin-util-linux/libfdisk/src/bsd.c
38+
===================================================================
39+
--- deepin-util-linux.orig/libfdisk/src/bsd.c 2025-02-18 19:21:07.031602241 +0800
40+
+++ deepin-util-linux/libfdisk/src/bsd.c 2025-03-07 13:31:55.000000000 +0800
41+
@@ -55,7 +55,7 @@
42+
{BSD_FS_V71K, "4.1BSD"},
43+
{BSD_FS_V8, "Eighth Edition"},
44+
{BSD_FS_BSDFFS, "4.2BSD"},
45+
-#ifdef __alpha__
46+
+#if defined(__alpha__) || defined(__sw_64__)
47+
{BSD_FS_EXT2, "ext2"},
48+
#else
49+
{BSD_FS_MSDOS, "MS-DOS"},
50+
@@ -80,7 +80,7 @@
51+
52+
struct dos_partition *dos_part; /* parent */
53+
struct bsd_disklabel bsd; /* on disk label */
54+
-#if defined (__alpha__)
55+
+#if defined(__alpha__) || defined(__sw_64__)
56+
/* We access this through a u_int64_t * when checksumming */
57+
char bsdbuffer[BSD_BBSIZE] __attribute__((aligned(8)));
58+
#else
59+
@@ -120,7 +120,7 @@
60+
}
61+
62+
63+
-#if defined (__alpha__)
64+
+#if defined(__alpha__) || defined(__sw_64__)
65+
static void alpha_bootblock_checksum (char *boot)
66+
{
67+
uint64_t *dp = (uint64_t *) boot, sum = 0;
68+
@@ -606,7 +606,7 @@
69+
struct bsd_disklabel *d = self_disklabel(cxt);
70+
uintmax_t res;
71+
72+
-#if defined (__alpha__) || defined (__ia64__)
73+
+#if defined (__alpha__) || defined (__ia64__) || defined(__sw_64__)
74+
if (fdisk_ask_number(cxt, DEFAULT_SECTOR_SIZE, d->d_secsize,
75+
UINT32_MAX, _("bytes/sector"), &res) == 0)
76+
d->d_secsize = res;
77+
@@ -712,7 +712,7 @@
78+
sector = 0;
79+
if (l->dos_part)
80+
sector = dos_partition_get_start(l->dos_part);
81+
-#if defined (__alpha__)
82+
+#if defined(__alpha__) || defined(__sw_64__)
83+
alpha_bootblock_checksum(l->bsdbuffer);
84+
#endif
85+
if (lseek(cxt->dev_fd, (off_t) sector * DEFAULT_SECTOR_SIZE, SEEK_SET) == -1) {
86+
@@ -769,7 +769,7 @@
87+
else
88+
d -> d_type = BSD_DTYPE_ST506;
89+
90+
-#if !defined (__alpha__)
91+
+#if ! (defined (__alpha__) || defined (__sw_64__))
92+
d -> d_flags = BSD_D_DOSPART;
93+
#else
94+
d -> d_flags = 0;
95+
@@ -893,7 +893,7 @@
96+
memmove(&l->bsdbuffer[BSD_LABELSECTOR * DEFAULT_SECTOR_SIZE
97+
+ BSD_LABELOFFSET], d, sizeof(*d));
98+
99+
-#if defined (__alpha__) && BSD_LABELSECTOR == 0
100+
+#if ( defined (__alpha__) || defined (__sw_64__) ) && BSD_LABELSECTOR == 0
101+
/* Write the checksum to the end of the first sector. */
102+
alpha_bootblock_checksum(l->bsdbuffer);
103+
#endif
104+
@@ -929,7 +929,7 @@
105+
case 0x06: /* DOS 16-bit >=32M */
106+
case 0xe1: /* DOS access */
107+
case 0xe3: /* DOS R/O */
108+
-#if !defined (__alpha__)
109+
+#if ! (defined (__alpha__) || defined (__sw_64__))
110+
case 0xf2: /* DOS secondary */
111+
return BSD_FS_MSDOS;
112+
#endif
113+
Index: deepin-util-linux/misc-utils/fincore.c
114+
===================================================================
115+
--- deepin-util-linux.orig/misc-utils/fincore.c 2025-02-18 19:21:07.043602342 +0800
116+
+++ deepin-util-linux/misc-utils/fincore.c 2025-03-07 13:31:55.000000000 +0800
117+
@@ -46,7 +46,7 @@
118+
#ifndef HAVE_CACHESTAT
119+
120+
#ifndef SYS_cachestat
121+
-#if defined (__alpha__)
122+
+#if defined(__alpha__) || defined(__sw_64__)
123+
#define SYS_cachestat 561
124+
#else
125+
#define SYS_cachestat 451
126+
Index: deepin-util-linux/sys-utils/hwclock-rtc.c
127+
===================================================================
128+
--- deepin-util-linux.orig/sys-utils/hwclock-rtc.c 2025-02-18 19:21:07.243604020 +0800
129+
+++ deepin-util-linux/sys-utils/hwclock-rtc.c 2025-03-07 13:31:55.000000000 +0800
130+
@@ -345,7 +345,7 @@
131+
return &rtc_interface;
132+
}
133+
134+
-#ifdef __alpha__
135+
+#if defined(__alpha__) || defined(__sw_64__)
136+
/*
137+
* Get the Hardware Clock epoch setting from the kernel.
138+
*/
139+
Index: deepin-util-linux/sys-utils/hwclock.c
140+
===================================================================
141+
--- deepin-util-linux.orig/sys-utils/hwclock.c 2025-02-18 19:21:07.243604020 +0800
142+
+++ deepin-util-linux/sys-utils/hwclock.c 2025-03-07 13:31:55.000000000 +0800
143+
@@ -1140,7 +1140,7 @@
144+
* Get or set the kernel RTC driver's epoch on Alpha machines.
145+
* ISA machines are hard coded for 1900.
146+
*/
147+
-#if defined(__linux__) && defined(__alpha__)
148+
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
149+
static void
150+
manipulate_epoch(const struct hwclock_control *ctl)
151+
{
152+
@@ -1229,7 +1229,7 @@
153+
puts(_(" -w, --systohc set the RTC from the system time"));
154+
puts(_(" --systz send timescale configurations to the kernel"));
155+
puts(_(" -a, --adjust adjust the RTC to account for systematic drift"));
156+
-#if defined(__linux__) && defined(__alpha__)
157+
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
158+
puts(_(" --getepoch display the RTC epoch"));
159+
puts(_(" --setepoch set the RTC epoch according to --epoch"));
160+
#endif
161+
@@ -1251,7 +1251,7 @@
162+
" --directisa use the ISA bus instead of %1$s access\n"), _PATH_RTC_DEV);
163+
puts(_(" --date <time> date/time input for --set and --predict"));
164+
puts(_(" --delay <sec> delay used when set new RTC time"));
165+
-#if defined(__linux__) && defined(__alpha__)
166+
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
167+
puts(_(" --epoch <year> epoch input for --setepoch"));
168+
#endif
169+
puts(_(" --update-drift update the RTC drift factor"));
170+
@@ -1332,7 +1332,7 @@
171+
{ "ul-debug", required_argument, NULL, 'd' },
172+
{ "verbose", no_argument, NULL, 'v' },
173+
{ "set", no_argument, NULL, OPT_SET },
174+
-#if defined(__linux__) && defined(__alpha__)
175+
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
176+
{ "getepoch", no_argument, NULL, OPT_GETEPOCH },
177+
{ "setepoch", no_argument, NULL, OPT_SETEPOCH },
178+
{ "epoch", required_argument, NULL, OPT_EPOCH },
179+
@@ -1442,7 +1442,7 @@
180+
ctl.show = 0;
181+
ctl.hwaudit_on = 1;
182+
break;
183+
-#if defined(__linux__) && defined(__alpha__)
184+
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
185+
case OPT_GETEPOCH:
186+
ctl.getepoch = 1;
187+
ctl.show = 0;
188+
@@ -1584,7 +1584,7 @@
189+
}
190+
#endif
191+
192+
-#if defined(__linux__) && defined(__alpha__)
193+
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
194+
if (ctl.getepoch || ctl.setepoch) {
195+
manipulate_epoch(&ctl);
196+
hwclock_exit(&ctl, EXIT_SUCCESS);
197+
Index: deepin-util-linux/sys-utils/hwclock.h
198+
===================================================================
199+
--- deepin-util-linux.orig/sys-utils/hwclock.h 2025-02-18 19:21:07.243604020 +0800
200+
+++ deepin-util-linux/sys-utils/hwclock.h 2025-03-07 13:31:55.000000000 +0800
201+
@@ -32,7 +32,7 @@
202+
char *date_opt;
203+
char *adj_file_name;
204+
double rtc_delay; /* --delay <seconds> */
205+
-#if defined(__linux__) && defined(__alpha__)
206+
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
207+
char *epoch_option;
208+
#endif
209+
#ifdef __linux__
210+
@@ -47,7 +47,7 @@
211+
hctosys:1,
212+
utc:1,
213+
systohc:1,
214+
-#if defined(__linux__) && defined(__alpha__)
215+
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
216+
getepoch:1,
217+
setepoch:1,
218+
#endif
219+
@@ -82,7 +82,7 @@
220+
extern double time_diff(struct timeval subtrahend, struct timeval subtractor);
221+
222+
/* rtc.c */
223+
-#if defined(__linux__) && defined(__alpha__)
224+
+#if defined(__linux__) && (defined(__alpha__) || defined(__sw_64__))
225+
extern int get_epoch_rtc(const struct hwclock_control *ctl, unsigned long *epoch);
226+
extern int set_epoch_rtc(const struct hwclock_control *ctl);
227+
#endif
228+
Index: deepin-util-linux/sys-utils/lscpu-cputype.c
229+
===================================================================
230+
--- deepin-util-linux.orig/sys-utils/lscpu-cputype.c 2025-02-18 19:21:07.243604020 +0800
231+
+++ deepin-util-linux/sys-utils/lscpu-cputype.c 2025-03-07 13:31:55.000000000 +0800
232+
@@ -626,7 +626,7 @@
233+
* information about our real CPU */
234+
;
235+
else {
236+
-#if defined(__alpha__) || defined(__ia64__)
237+
+#if defined(__alpha__) || defined(__ia64__) || defined(__sw_64__)
238+
ar->bit64 = 1; /* 64bit platforms only */
239+
#endif
240+
/* platforms with 64bit flag in /proc/cpuinfo, define
241+
Index: deepin-util-linux/sys-utils/setarch.c
242+
===================================================================
243+
--- deepin-util-linux.orig/sys-utils/setarch.c 2025-02-18 19:21:07.247604054 +0800
244+
+++ deepin-util-linux/sys-utils/setarch.c 2025-03-07 13:31:55.000000000 +0800
245+
@@ -234,7 +234,7 @@
246+
{PER_LINUX32, "mips", "mips"},
247+
{PER_LINUX, "mips64", "mips64"},
248+
#endif
249+
-#if defined(__alpha__)
250+
+#if defined(__alpha__) || defined(__sw_64__)
251+
{PER_LINUX, "alpha", "alpha"},
252+
{PER_LINUX, "alphaev5", "alpha"},
253+
{PER_LINUX, "alphaev56", "alpha"},

debian/patches/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ upstream-master/lib-colors-fix-fallback-to-system-directory.patch
2626
debian/usec-umac-adapt.patch
2727
uniontech-backward-lsblk.patch
2828
debian/login-turn-on-utmp-writing.patch
29+
add-sunway-support.patch

0 commit comments

Comments
 (0)